Introduce new libzcash Zcash protocol API and crypto constructions surrounding the zkSNARK circuit.

This commit is contained in:
Sean Bowe
2016-05-04 18:25:42 -06:00
parent 5961dcb6da
commit 369df06583
9 changed files with 729 additions and 0 deletions

23
src/zcash/Address.cpp Normal file
View 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());
}
}