| 565 | } |
| 566 | |
| 567 | Signature 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 | |
| 586 | bool check_sendproof(const PublicKey &txkey_pub, const PublicKey &receiver_address_V, const KeyDerivation &derivation, |
| 587 | const Hash &message_hash, const Signature &proof) { |
no test coverage detected