Add Sapling have/get sk crypter overrides

This commit is contained in:
Jay Graber
2018-07-12 14:57:53 -07:00
committed by Jack Grigg
parent 871e1726c6
commit 55f2889396
4 changed files with 64 additions and 4 deletions

View File

@@ -6,6 +6,9 @@
#include <librustzcash.h>
const unsigned char ZCASH_SAPLING_FVFP_PERSONALIZATION[crypto_generichash_blake2b_PERSONALBYTES] =
{'Z', 'c', 'a', 's', 'h', 'S', 'a', 'p', 'l', 'i', 'n', 'g', 'F', 'V', 'F', 'P'};
namespace libzcash {
uint256 SproutPaymentAddress::GetHash() const {
@@ -73,6 +76,13 @@ bool SaplingFullViewingKey::is_valid() const {
return !ivk.IsNull();
}
uint256 SaplingFullViewingKey::GetFingerprint() const {
CBLAKE2bWriter ss(SER_GETHASH, 0, ZCASH_SAPLING_FVFP_PERSONALIZATION);
ss << *this;
return ss.GetHash();
}
SaplingSpendingKey SaplingSpendingKey::random() {
while (true) {
auto sk = SaplingSpendingKey(random_uint256());