MCPcopy Create free account
hub / github.com/bcndev/bytecoin / generate_sendproof

Function generate_sendproof

src/crypto/crypto.cpp:567–584  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

565}
566
567Signature generate_sendproof(const PublicKey &txkey_pub,
568 const SecretKey &txkey_sec,
569 const PublicKey &receiver_address_V,
570 const KeyDerivation &derivation,
571 const Hash &message_hash) {
572 const P3 receiver_address_V_p3(receiver_address_V);
573 const EllipticCurveScalar k = random_scalar();
574
575 KeccakStream cr_comm;
576 cr_comm << message_hash << txkey_pub << receiver_address_V << derivation << to_bytes(k * G);
577 const P3 tmp3 = k * receiver_address_V_p3;
578 cr_comm << to_bytes(tmp3.mul8());
579
580 Signature proof;
581 proof.c = cr_comm.hash_to_scalar();
582 proof.r = k - proof.c * txkey_sec;
583 return proof;
584}
585
586bool check_sendproof(const PublicKey &txkey_pub, const PublicKey &receiver_address_V, const KeyDerivation &derivation,
587 const Hash &message_hash, const Signature &proof) {

Callers 1

api_create_proofMethod · 0.85

Calls 4

random_scalarFunction · 0.85
to_bytesFunction · 0.85
mul8Method · 0.80
hash_to_scalarMethod · 0.45

Tested by

no test coverage detected