#ifndef LIBRUSTZCASH_INCLUDE_H_ #define LIBRUSTZCASH_INCLUDE_H_ #include extern "C" { uint64_t librustzcash_xor(uint64_t a, uint64_t b); /// Loads the zk-SNARK parameters into memory and saves /// paths as necessary. Only called once. void librustzcash_init_zksnark_params( const char* spend_path, const char* output_path, const char* sprout_path ); /// Writes the "uncommitted" note value for empty leaves /// of the merkle tree. `result` must be a valid pointer /// to 32 bytes which will be written. void librustzcash_tree_uncommitted( unsigned char *result ); /// Computes a merkle tree hash for a given depth. /// The `depth` parameter should not be larger than /// 62. /// /// `a` and `b` each must be of length 32, and must each /// be scalars of BLS12-381. /// /// The result of the merkle tree hash is placed in /// `result`, which must also be of length 32. void librustzcash_merkle_hash( size_t depth, const unsigned char *a, const unsigned char *b, unsigned char *result ); /// Creates a Sapling verification context. Please free this /// when you're done. void * librustzcash_sapling_verification_ctx_init(); /// Check the validity of a Sapling Spend description, /// accumulating the value commitment into the context. bool librustzcash_sapling_check_spend( void *ctx, const unsigned char *cv, const unsigned char *anchor, const unsigned char *nullifier, const unsigned char *rk, const unsigned char *zkproof, const unsigned char *spendAuthSig, const unsigned char *sighashValue ); /// Check the validity of a Sapling Output description, /// accumulating the value commitment into the context. bool librustzcash_sapling_check_output( void *ctx, const unsigned char *cv, const unsigned char *cm, const unsigned char *ephemeralKey, const unsigned char *zkproof ); /// Finally checks the validity of the entire Sapling /// transaction given valueBalance and the binding signature. bool librustzcash_sapling_final_check( void *ctx, int64_t valueBalance, const unsigned char *bindingSig, const unsigned char *sighashValue ); /// Frees a Sapling verification context returned from /// `librustzcash_sapling_verification_ctx_init`. void librustzcash_sapling_verification_ctx_free(void *); } #endif // LIBRUSTZCASH_INCLUDE_H_