Introduce new libzcash Zcash protocol API and crypto constructions surrounding the zkSNARK circuit.
This commit is contained in:
23
src/zcash/Address.cpp
Normal file
23
src/zcash/Address.cpp
Normal file
@@ -0,0 +1,23 @@
|
||||
#include "Address.hpp"
|
||||
#include "NoteEncryption.hpp"
|
||||
#include "prf.h"
|
||||
|
||||
namespace libzcash {
|
||||
|
||||
uint256 ViewingKey::pk_enc() {
|
||||
return ZCNoteEncryption::generate_pubkey(*this);
|
||||
}
|
||||
|
||||
ViewingKey SpendingKey::viewing_key() {
|
||||
return ViewingKey(ZCNoteEncryption::generate_privkey(*this));
|
||||
}
|
||||
|
||||
SpendingKey SpendingKey::random() {
|
||||
return SpendingKey(random_uint256());
|
||||
}
|
||||
|
||||
PaymentAddress SpendingKey::address() {
|
||||
return PaymentAddress(PRF_addr_a_pk(*this), viewing_key().pk_enc());
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user