|
|
|
// Copyright (c) 2019-2020 The Hush developers
|
|
|
|
// Distributed under the GPLv3 software license, see the accompanying
|
|
|
|
// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
|
|
|
|
|
|
|
#include <stdexcept>
|
|
|
|
|
|
|
|
#include <boost/foreach.hpp>
|
|
|
|
|
|
|
|
#include "zcash/IncrementalMerkleTree.hpp"
|
|
|
|
#include "crypto/sha256.h"
|
|
|
|
#include "zcash/util.h"
|
|
|
|
#include "librustzcash.h"
|
|
|
|
|
|
|
|
namespace libzcash {
|
|
|
|
|
|
|
|
PedersenHash PedersenHash::combine(
|
|
|
|
const PedersenHash& a,
|
|
|
|
const PedersenHash& b,
|
|
|
|
size_t depth
|
|
|
|
)
|
|
|
|
{
|
|
|
|
PedersenHash res = PedersenHash();
|
|
|
|
|
|
|
|
librustzcash_merkle_hash(
|
|
|
|
depth,
|
|
|
|
a.begin(),
|
|
|
|
b.begin(),
|
|
|
|
res.begin()
|
|
|
|
);
|
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
PedersenHash PedersenHash::uncommitted() {
|
|
|
|
PedersenHash res = PedersenHash();
|
|
|
|
|
|
|
|
librustzcash_tree_uncommitted(res.begin());
|
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const std::array<PedersenHash, 65> pedersen_empty_roots = {
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0x81, 0x7d, 0xe3, 0x6a, 0xb2, 0xd5, 0x7f, 0xeb,
|
|
|
|
0x07, 0x76, 0x34, 0xbc, 0xa7, 0x78, 0x19, 0xc8,
|
|
|
|
0xe0, 0xbd, 0x29, 0x8c, 0x04, 0xf6, 0xfe, 0xd0,
|
|
|
|
0xe6, 0xa8, 0x3c, 0xc1, 0x35, 0x6c, 0xa1, 0x55,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0xff, 0xe9, 0xfc, 0x03, 0xf1, 0x8b, 0x17, 0x6c,
|
|
|
|
0x99, 0x88, 0x06, 0x43, 0x9f, 0xf0, 0xbb, 0x8a,
|
|
|
|
0xd1, 0x93, 0xaf, 0xdb, 0x27, 0xb2, 0xcc, 0xbc,
|
|
|
|
0x88, 0x85, 0x69, 0x16, 0xdd, 0x80, 0x4e, 0x34,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0xd8, 0x28, 0x33, 0x86, 0xef, 0x2e, 0xf0, 0x7e,
|
|
|
|
0xbd, 0xbb, 0x43, 0x83, 0xc1, 0x2a, 0x73, 0x9a,
|
|
|
|
0x95, 0x3a, 0x4d, 0x6e, 0x0d, 0x6f, 0xb1, 0x13,
|
|
|
|
0x9a, 0x40, 0x36, 0xd6, 0x93, 0xbf, 0xbb, 0x6c,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0xe1, 0x10, 0xde, 0x65, 0xc9, 0x07, 0xb9, 0xde,
|
|
|
|
0xa4, 0xae, 0x0b, 0xd8, 0x3a, 0x4b, 0x0a, 0x51,
|
|
|
|
0xbe, 0xa1, 0x75, 0x64, 0x6a, 0x64, 0xc1, 0x2b,
|
|
|
|
0x4c, 0x9f, 0x93, 0x1b, 0x2c, 0xb3, 0x1b, 0x49,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0x91, 0x2d, 0x82, 0xb2, 0xc2, 0xbc, 0xa2, 0x31,
|
|
|
|
0xf7, 0x1e, 0xfc, 0xf6, 0x17, 0x37, 0xfb, 0xf0,
|
|
|
|
0xa0, 0x8b, 0xef, 0xa0, 0x41, 0x62, 0x15, 0xae,
|
|
|
|
0xef, 0x53, 0xe8, 0xbb, 0x6d, 0x23, 0x39, 0x0a,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0x8a, 0xc9, 0xcf, 0x9c, 0x39, 0x1e, 0x3f, 0xd4,
|
|
|
|
0x28, 0x91, 0xd2, 0x72, 0x38, 0xa8, 0x1a, 0x8a,
|
|
|
|
0x5c, 0x1d, 0x3a, 0x72, 0xb1, 0xbc, 0xbe, 0xa8,
|
|
|
|
0xcf, 0x44, 0xa5, 0x8c, 0xe7, 0x38, 0x96, 0x13,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0xd6, 0xc6, 0x39, 0xac, 0x24, 0xb4, 0x6b, 0xd1,
|
|
|
|
0x93, 0x41, 0xc9, 0x1b, 0x13, 0xfd, 0xca, 0xb3,
|
|
|
|
0x15, 0x81, 0xdd, 0xaf, 0x7f, 0x14, 0x11, 0x33,
|
|
|
|
0x6a, 0x27, 0x1f, 0x3d, 0x0a, 0xa5, 0x28, 0x13,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0x7b, 0x99, 0xab, 0xdc, 0x37, 0x30, 0x99, 0x1c,
|
|
|
|
0xc9, 0x27, 0x47, 0x27, 0xd7, 0xd8, 0x2d, 0x28,
|
|
|
|
0xcb, 0x79, 0x4e, 0xdb, 0xc7, 0x03, 0x4b, 0x4f,
|
|
|
|
0x00, 0x53, 0xff, 0x7c, 0x4b, 0x68, 0x04, 0x44,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0x43, 0xff, 0x54, 0x57, 0xf1, 0x3b, 0x92, 0x6b,
|
|
|
|
0x61, 0xdf, 0x55, 0x2d, 0x4e, 0x40, 0x2e, 0xe6,
|
|
|
|
0xdc, 0x14, 0x63, 0xf9, 0x9a, 0x53, 0x5f, 0x9a,
|
|
|
|
0x71, 0x34, 0x39, 0x26, 0x4d, 0x5b, 0x61, 0x6b,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0xba, 0x49, 0xb6, 0x59, 0xfb, 0xd0, 0xb7, 0x33,
|
|
|
|
0x42, 0x11, 0xea, 0x6a, 0x9d, 0x9d, 0xf1, 0x85,
|
|
|
|
0xc7, 0x57, 0xe7, 0x0a, 0xa8, 0x1d, 0xa5, 0x62,
|
|
|
|
0xfb, 0x91, 0x2b, 0x84, 0xf4, 0x9b, 0xce, 0x72,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0x47, 0x77, 0xc8, 0x77, 0x6a, 0x3b, 0x1e, 0x69,
|
|
|
|
0xb7, 0x3a, 0x62, 0xfa, 0x70, 0x1f, 0xa4, 0xf7,
|
|
|
|
0xa6, 0x28, 0x2d, 0x9a, 0xee, 0x2c, 0x7a, 0x6b,
|
|
|
|
0x82, 0xe7, 0x93, 0x7d, 0x70, 0x81, 0xc2, 0x3c,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0xec, 0x67, 0x71, 0x14, 0xc2, 0x72, 0x06, 0xf5,
|
|
|
|
0xde, 0xbc, 0x1c, 0x1e, 0xd6, 0x6f, 0x95, 0xe2,
|
|
|
|
0xb1, 0x88, 0x5d, 0xa5, 0xb7, 0xbe, 0x3d, 0x73,
|
|
|
|
0x6b, 0x1d, 0xe9, 0x85, 0x79, 0x47, 0x30, 0x48,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0x1b, 0x77, 0xda, 0xc4, 0xd2, 0x4f, 0xb7, 0x25,
|
|
|
|
0x8c, 0x3c, 0x52, 0x87, 0x04, 0xc5, 0x94, 0x30,
|
|
|
|
0xb6, 0x30, 0x71, 0x8b, 0xec, 0x48, 0x64, 0x21,
|
|
|
|
0x83, 0x70, 0x21, 0xcf, 0x75, 0xda, 0xb6, 0x51,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0xbd, 0x74, 0xb2, 0x5a, 0xac, 0xb9, 0x23, 0x78,
|
|
|
|
0xa8, 0x71, 0xbf, 0x27, 0xd2, 0x25, 0xcf, 0xc2,
|
|
|
|
0x6b, 0xac, 0xa3, 0x44, 0xa1, 0xea, 0x35, 0xfd,
|
|
|
|
0xd9, 0x45, 0x10, 0xf3, 0xd1, 0x57, 0x08, 0x2c,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0xd6, 0xac, 0xde, 0xdf, 0x95, 0xf6, 0x08, 0xe0,
|
|
|
|
0x9f, 0xa5, 0x3f, 0xb4, 0x3d, 0xcd, 0x09, 0x90,
|
|
|
|
0x47, 0x57, 0x26, 0xc5, 0x13, 0x12, 0x10, 0xc9,
|
|
|
|
0xe5, 0xca, 0xea, 0xb9, 0x7f, 0x0e, 0x64, 0x2f,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0x1e, 0xa6, 0x67, 0x5f, 0x95, 0x51, 0xee, 0xb9,
|
|
|
|
0xdf, 0xaa, 0xa9, 0x24, 0x7b, 0xc9, 0x85, 0x82,
|
|
|
|
0x70, 0xd3, 0xd3, 0xa4, 0xc5, 0xaf, 0xa7, 0x17,
|
|
|
|
0x7a, 0x98, 0x4d, 0x5e, 0xd1, 0xbe, 0x24, 0x51,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0x6e, 0xdb, 0x16, 0xd0, 0x19, 0x07, 0xb7, 0x59,
|
|
|
|
0x97, 0x7d, 0x76, 0x50, 0xda, 0xd7, 0xe3, 0xec,
|
|
|
|
0x04, 0x9a, 0xf1, 0xa3, 0xd8, 0x75, 0x38, 0x0b,
|
|
|
|
0x69, 0x7c, 0x86, 0x2c, 0x9e, 0xc5, 0xd5, 0x1c,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0xcd, 0x1c, 0x8d, 0xbf, 0x6e, 0x3a, 0xcc, 0x7a,
|
|
|
|
0x80, 0x43, 0x9b, 0xc4, 0x96, 0x2c, 0xf2, 0x5b,
|
|
|
|
0x9d, 0xce, 0x7c, 0x89, 0x6f, 0x3a, 0x5b, 0xd7,
|
|
|
|
0x08, 0x03, 0xfc, 0x5a, 0x0e, 0x33, 0xcf, 0x00,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0x6a, 0xca, 0x84, 0x48, 0xd8, 0x26, 0x3e, 0x54,
|
|
|
|
0x7d, 0x5f, 0xf2, 0x95, 0x0e, 0x2e, 0xd3, 0x83,
|
|
|
|
0x9e, 0x99, 0x8d, 0x31, 0xcb, 0xc6, 0xac, 0x9f,
|
|
|
|
0xd5, 0x7b, 0xc6, 0x00, 0x2b, 0x15, 0x92, 0x16,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0x8d, 0x5f, 0xa4, 0x3e, 0x5a, 0x10, 0xd1, 0x16,
|
|
|
|
0x05, 0xac, 0x74, 0x30, 0xba, 0x1f, 0x5d, 0x81,
|
|
|
|
0xfb, 0x1b, 0x68, 0xd2, 0x9a, 0x64, 0x04, 0x05,
|
|
|
|
0x76, 0x77, 0x49, 0xe8, 0x41, 0x52, 0x76, 0x73,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0x08, 0xee, 0xab, 0x0c, 0x13, 0xab, 0xd6, 0x06,
|
|
|
|
0x9e, 0x63, 0x10, 0x19, 0x7b, 0xf8, 0x0f, 0x9c,
|
|
|
|
0x1e, 0xa6, 0xde, 0x78, 0xfd, 0x19, 0xcb, 0xae,
|
|
|
|
0x24, 0xd4, 0xa5, 0x20, 0xe6, 0xcf, 0x30, 0x23,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0x07, 0x69, 0x55, 0x7b, 0xc6, 0x82, 0xb1, 0xbf,
|
|
|
|
0x30, 0x86, 0x46, 0xfd, 0x0b, 0x22, 0xe6, 0x48,
|
|
|
|
0xe8, 0xb9, 0xe9, 0x8f, 0x57, 0xe2, 0x9f, 0x5a,
|
|
|
|
0xf4, 0x0f, 0x6e, 0xdb, 0x83, 0x3e, 0x2c, 0x49,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0x4c, 0x69, 0x37, 0xd7, 0x8f, 0x42, 0x68, 0x5f,
|
|
|
|
0x84, 0xb4, 0x3a, 0xd3, 0xb7, 0xb0, 0x0f, 0x81,
|
|
|
|
0x28, 0x56, 0x62, 0xf8, 0x5c, 0x6a, 0x68, 0xef,
|
|
|
|
0x11, 0xd6, 0x2a, 0xd1, 0xa3, 0xee, 0x08, 0x50,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0xfe, 0xe0, 0xe5, 0x28, 0x02, 0xcb, 0x0c, 0x46,
|
|
|
|
0xb1, 0xeb, 0x4d, 0x37, 0x6c, 0x62, 0x69, 0x7f,
|
|
|
|
0x47, 0x59, 0xf6, 0xc8, 0x91, 0x7f, 0xa3, 0x52,
|
|
|
|
0x57, 0x12, 0x02, 0xfd, 0x77, 0x8f, 0xd7, 0x12,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0x16, 0xd6, 0x25, 0x29, 0x68, 0x97, 0x1a, 0x83,
|
|
|
|
0xda, 0x85, 0x21, 0xd6, 0x53, 0x82, 0xe6, 0x1f,
|
|
|
|
0x01, 0x76, 0x64, 0x6d, 0x77, 0x1c, 0x91, 0x52,
|
|
|
|
0x8e, 0x32, 0x76, 0xee, 0x45, 0x38, 0x3e, 0x4a,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0xd2, 0xe1, 0x64, 0x2c, 0x9a, 0x46, 0x22, 0x29,
|
|
|
|
0x28, 0x9e, 0x5b, 0x0e, 0x3b, 0x7f, 0x90, 0x08,
|
|
|
|
0xe0, 0x30, 0x1c, 0xbb, 0x93, 0x38, 0x5e, 0xe0,
|
|
|
|
0xe2, 0x1d, 0xa2, 0x54, 0x50, 0x73, 0xcb, 0x58,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0xa5, 0x12, 0x2c, 0x08, 0xff, 0x9c, 0x16, 0x1d,
|
|
|
|
0x9c, 0xa6, 0xfc, 0x46, 0x20, 0x73, 0x39, 0x6c,
|
|
|
|
0x7d, 0x7d, 0x38, 0xe8, 0xee, 0x48, 0xcd, 0xb3,
|
|
|
|
0xbe, 0xa7, 0xe2, 0x23, 0x01, 0x34, 0xed, 0x6a,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0x28, 0xe7, 0xb8, 0x41, 0xdc, 0xbc, 0x47, 0xcc,
|
|
|
|
0xeb, 0x69, 0xd7, 0xcb, 0x8d, 0x94, 0x24, 0x5f,
|
|
|
|
0xb7, 0xcb, 0x2b, 0xa3, 0xa7, 0xa6, 0xbc, 0x18,
|
|
|
|
0xf1, 0x3f, 0x94, 0x5f, 0x7d, 0xbd, 0x6e, 0x2a,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0xe1, 0xf3, 0x4b, 0x03, 0x4d, 0x4a, 0x3c, 0xd2,
|
|
|
|
0x85, 0x57, 0xe2, 0x90, 0x7e, 0xbf, 0x99, 0x0c,
|
|
|
|
0x91, 0x8f, 0x64, 0xec, 0xb5, 0x0a, 0x94, 0xf0,
|
|
|
|
0x1d, 0x6f, 0xda, 0x5c, 0xa5, 0xc7, 0xef, 0x72,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0x12, 0x93, 0x5f, 0x14, 0xb6, 0x76, 0x50, 0x9b,
|
|
|
|
0x81, 0xeb, 0x49, 0xef, 0x25, 0xf3, 0x92, 0x69,
|
|
|
|
0xed, 0x72, 0x30, 0x92, 0x38, 0xb4, 0xc1, 0x45,
|
|
|
|
0x80, 0x35, 0x44, 0xb6, 0x46, 0xdc, 0xa6, 0x2d,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0xb2, 0xee, 0xd0, 0x31, 0xd4, 0xd6, 0xa4, 0xf0,
|
|
|
|
0x2a, 0x09, 0x7f, 0x80, 0xb5, 0x4c, 0xc1, 0x54,
|
|
|
|
0x1d, 0x41, 0x63, 0xc6, 0xb6, 0xf5, 0x97, 0x1f,
|
|
|
|
0x88, 0xb6, 0xe4, 0x1d, 0x35, 0xc5, 0x38, 0x14,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0xfb, 0xc2, 0xf4, 0x30, 0x0c, 0x01, 0xf0, 0xb7,
|
|
|
|
0x82, 0x0d, 0x00, 0xe3, 0x34, 0x7c, 0x8d, 0xa4,
|
|
|
|
0xee, 0x61, 0x46, 0x74, 0x37, 0x6c, 0xbc, 0x45,
|
|
|
|
0x35, 0x9d, 0xaa, 0x54, 0xf9, 0xb5, 0x49, 0x3e,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0x25, 0x2e, 0x67, 0x98, 0x64, 0x5f, 0x5b, 0xf1,
|
|
|
|
0x14, 0xe4, 0xb4, 0xe9, 0x0e, 0x96, 0x18, 0x28,
|
|
|
|
0x61, 0x48, 0x98, 0x40, 0xd9, 0xb4, 0xcc, 0xc4,
|
|
|
|
0xc1, 0xfb, 0x5a, 0x46, 0x99, 0x7c, 0xee, 0x14,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0x98, 0xb1, 0x90, 0x42, 0xf1, 0xf7, 0xc7, 0xdd,
|
|
|
|
0x11, 0xec, 0x25, 0xea, 0x66, 0xb6, 0xff, 0x74,
|
|
|
|
0xe0, 0x8c, 0xe1, 0x1d, 0x44, 0x7e, 0xd6, 0xf1,
|
|
|
|
0xbf, 0xe8, 0x7e, 0x11, 0x0e, 0x33, 0x1e, 0x11,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0xd4, 0x51, 0x30, 0x47, 0x99, 0x57, 0x2b, 0xa9,
|
|
|
|
0xf4, 0x2c, 0x4d, 0xab, 0x6b, 0x07, 0xc7, 0x03,
|
|
|
|
0xbd, 0x2c, 0x12, 0x3a, 0xb9, 0xd6, 0x0f, 0x2a,
|
|
|
|
0x60, 0xf9, 0x95, 0x58, 0x54, 0x91, 0x0b, 0x6a,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0x3e, 0xcd, 0x5f, 0x27, 0xac, 0xf0, 0x1b, 0xd3,
|
|
|
|
0x7a, 0x33, 0xe4, 0x51, 0x78, 0x67, 0xef, 0x76,
|
|
|
|
0x47, 0x4c, 0xd8, 0x3f, 0xb3, 0x1c, 0x92, 0x08,
|
|
|
|
0xdc, 0xef, 0x2e, 0xed, 0xce, 0xf3, 0x6c, 0x72,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0x26, 0xc3, 0x7d, 0xa6, 0x78, 0x94, 0xa1, 0x3d,
|
|
|
|
0xf8, 0xaa, 0x48, 0x78, 0xd2, 0x51, 0x4a, 0x42,
|
|
|
|
0x12, 0x57, 0x3b, 0x73, 0xec, 0xca, 0xab, 0x16,
|
|
|
|
0xfe, 0x4f, 0xa6, 0x60, 0xe8, 0xfe, 0x27, 0x07,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0xb5, 0x45, 0xef, 0x34, 0x48, 0x5e, 0xed, 0x30,
|
|
|
|
0xd4, 0x2b, 0x2c, 0x29, 0x5a, 0x4a, 0x5b, 0x68,
|
|
|
|
0x0d, 0xe8, 0xa9, 0xd5, 0xe3, 0x83, 0x45, 0x78,
|
|
|
|
0x24, 0x62, 0xc0, 0x4f, 0x09, 0xdc, 0x68, 0x51,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0x77, 0xfd, 0x20, 0xb3, 0x00, 0x94, 0x67, 0x65,
|
|
|
|
0xa8, 0x7f, 0x24, 0xbd, 0x04, 0x50, 0x73, 0x72,
|
|
|
|
0x9c, 0xbd, 0x7b, 0x66, 0xeb, 0x8f, 0xa1, 0x40,
|
|
|
|
0xb5, 0x83, 0xfa, 0xa9, 0xd1, 0x42, 0x58, 0x01,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0xcb, 0xaa, 0x57, 0x6b, 0x17, 0x99, 0xb5, 0x8f,
|
|
|
|
0xf3, 0xa6, 0xde, 0xcb, 0xba, 0x91, 0x9b, 0x0b,
|
|
|
|
0x68, 0xd7, 0xc8, 0x93, 0xe4, 0x6f, 0xde, 0x99,
|
|
|
|
0x87, 0x68, 0xe8, 0x7e, 0x35, 0x0a, 0x07, 0x25,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0x45, 0xfe, 0x81, 0xb1, 0x8c, 0xa3, 0x00, 0x74,
|
|
|
|
0xd0, 0x12, 0x0d, 0x2b, 0x1a, 0x0d, 0x10, 0xb3,
|
|
|
|
0xa0, 0x50, 0x93, 0x35, 0x12, 0xdb, 0x8e, 0xe3,
|
|
|
|
0x4e, 0x52, 0x47, 0x3d, 0x4f, 0x08, 0xa2, 0x67,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0x0e, 0x60, 0xa1, 0xf0, 0x12, 0x1f, 0x59, 0x1e,
|
|
|
|
0x55, 0x1d, 0x3e, 0xd1, 0x86, 0x5b, 0x50, 0xa7,
|
|
|
|
0x5d, 0x7c, 0xcf, 0xf1, 0x28, 0x9d, 0xf7, 0xc4,
|
|
|
|
0x4d, 0xd4, 0x65, 0xa5, 0x43, 0x17, 0xf5, 0x6a,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0xce, 0xdf, 0xb1, 0x84, 0xdd, 0x92, 0xa0, 0xcb,
|
|
|
|
0xfc, 0x11, 0xe8, 0xbe, 0x69, 0x7b, 0x47, 0x69,
|
|
|
|
0x88, 0xed, 0x5f, 0x39, 0x36, 0x9a, 0xbd, 0xd9,
|
|
|
|
0x0c, 0x61, 0x54, 0x49, 0x88, 0x60, 0x1c, 0x0d,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0xf3, 0x62, 0x68, 0x66, 0x12, 0x64, 0x9a, 0x31,
|
|
|
|
0x3b, 0xa4, 0x64, 0x43, 0x7a, 0x0c, 0xad, 0x0e,
|
|
|
|
0x7e, 0x3d, 0x7e, 0x1b, 0x4b, 0x37, 0x43, 0xf9,
|
|
|
|
0x0e, 0x05, 0xa2, 0x10, 0x0a, 0x49, 0x5f, 0x42,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0x7d, 0xea, 0xe5, 0xf3, 0xbb, 0xde, 0xff, 0xd3,
|
|
|
|
0xf8, 0x52, 0x71, 0xa0, 0x8b, 0x5e, 0xc3, 0x1f,
|
|
|
|
0x16, 0xf9, 0x37, 0x96, 0x4a, 0xe7, 0x08, 0xfd,
|
|
|
|
0xff, 0x7c, 0x13, 0xe5, 0xa4, 0xf3, 0xdf, 0x6b,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0x40, 0xcc, 0xf0, 0xfc, 0x1e, 0xab, 0x6d, 0x85,
|
|
|
|
0x02, 0xbd, 0x93, 0xdc, 0x31, 0x34, 0x2d, 0xfd,
|
|
|
|
0x57, 0xdf, 0x5b, 0xbb, 0x5d, 0x70, 0xa1, 0xbf,
|
|
|
|
0x6b, 0x92, 0xef, 0xc6, 0x1e, 0xc9, 0xa2, 0x58,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0xd7, 0x80, 0x25, 0x49, 0x1f, 0x1b, 0xca, 0x85,
|
|
|
|
0x07, 0xf6, 0x4f, 0x25, 0x87, 0x2d, 0xd0, 0x23,
|
|
|
|
0x88, 0x47, 0x9a, 0x1a, 0x22, 0x51, 0x26, 0xe4,
|
|
|
|
0x0d, 0x2f, 0xe4, 0x18, 0xb9, 0x8e, 0x0e, 0x2c,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0x0d, 0xb7, 0x29, 0x46, 0x85, 0xc8, 0xa0, 0x72,
|
|
|
|
0x5f, 0x15, 0x84, 0x6e, 0xa5, 0x89, 0x9e, 0xa0,
|
|
|
|
0xe9, 0x86, 0xc2, 0x70, 0x7b, 0xd7, 0xb4, 0x12,
|
|
|
|
0x95, 0x44, 0x12, 0xf2, 0x6a, 0xbf, 0x55, 0x0a,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0xb7, 0xe2, 0x90, 0xbe, 0x95, 0x55, 0xcf, 0x75,
|
|
|
|
0x54, 0x86, 0x50, 0xda, 0x6d, 0x47, 0xc8, 0x93,
|
|
|
|
0xae, 0xf7, 0xf8, 0xc6, 0xdd, 0x27, 0x35, 0x49,
|
|
|
|
0x94, 0x95, 0xf6, 0x36, 0x59, 0x0d, 0xae, 0x0a,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0x2d, 0xd2, 0x53, 0x2a, 0x85, 0x8c, 0x30, 0x01,
|
|
|
|
0x45, 0xa6, 0x5e, 0x35, 0x1f, 0x91, 0xbe, 0x6a,
|
|
|
|
0xfe, 0xab, 0x59, 0x7c, 0x41, 0xef, 0x07, 0x3f,
|
|
|
|
0x50, 0xb6, 0x22, 0xd5, 0x86, 0xff, 0x59, 0x27,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0x97, 0x2f, 0x0c, 0x5c, 0x6f, 0x9a, 0xeb, 0x0e,
|
|
|
|
0x38, 0xbf, 0x83, 0x19, 0xf3, 0xa5, 0xfc, 0xdc,
|
|
|
|
0x8f, 0xd8, 0x78, 0x2e, 0x41, 0x88, 0x73, 0x0c,
|
|
|
|
0xd0, 0x82, 0xd9, 0xba, 0xbc, 0x58, 0x98, 0x51,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0x00, 0x1e, 0x57, 0x7b, 0x0f, 0x43, 0x90, 0x18,
|
|
|
|
0x2b, 0x4a, 0xe4, 0x3d, 0x32, 0x9b, 0x3a, 0xa8,
|
|
|
|
0x83, 0x5d, 0xae, 0x1b, 0xb7, 0x9e, 0x60, 0x4b,
|
|
|
|
0x7d, 0x2d, 0xa0, 0xe9, 0x0d, 0x06, 0x09, 0x29,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0xaa, 0x6e, 0x70, 0xa9, 0x1e, 0xbc, 0x54, 0xee,
|
|
|
|
0xfc, 0xe5, 0xff, 0xd5, 0xb6, 0x75, 0xda, 0xf3,
|
|
|
|
0xf1, 0xd9, 0x40, 0xa8, 0x45, 0x1f, 0xcb, 0x01,
|
|
|
|
0x08, 0x1f, 0xa9, 0xd4, 0xf2, 0x62, 0x43, 0x6f,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0xd7, 0x70, 0x38, 0xbf, 0x67, 0xe6, 0x31, 0x75,
|
|
|
|
0x29, 0x40, 0x23, 0x12, 0x51, 0xd7, 0xfe, 0x85,
|
|
|
|
0xaf, 0x52, 0xdb, 0xdd, 0x6a, 0xab, 0x37, 0xc7,
|
|
|
|
0xa5, 0xec, 0x32, 0xb6, 0x5f, 0xe6, 0xde, 0x03,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0xd2, 0x27, 0xa1, 0x7a, 0x7e, 0x0c, 0xf9, 0x6d,
|
|
|
|
0xce, 0xdd, 0x9f, 0xc7, 0xbc, 0xe4, 0x3c, 0x6c,
|
|
|
|
0x1d, 0x66, 0xba, 0xdd, 0x75, 0x43, 0xa8, 0x87,
|
|
|
|
0xc8, 0x65, 0x6c, 0x54, 0x7e, 0xcf, 0xb2, 0x4f,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0x70, 0xe8, 0xa5, 0x21, 0x95, 0x15, 0x83, 0xe5,
|
|
|
|
0x3f, 0xc0, 0x58, 0x5c, 0x70, 0x7e, 0xce, 0xda,
|
|
|
|
0x89, 0xb7, 0xa7, 0xd1, 0xaf, 0x41, 0xd1, 0xa0,
|
|
|
|
0x15, 0xd7, 0x97, 0xfa, 0x76, 0xc0, 0xf5, 0x69,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0xe4, 0x85, 0xa9, 0x68, 0x55, 0xe8, 0x72, 0xfc,
|
|
|
|
0x50, 0x90, 0x15, 0x0e, 0x2c, 0xd2, 0x4e, 0x10,
|
|
|
|
0x59, 0x1d, 0x35, 0x16, 0x6e, 0xb0, 0xeb, 0x30,
|
|
|
|
0xfc, 0xdf, 0xac, 0x93, 0xb0, 0x1d, 0x28, 0x1c,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0xe4, 0xa1, 0x9f, 0xeb, 0xdf, 0x2a, 0x86, 0x89,
|
|
|
|
0x6e, 0x41, 0xf2, 0xce, 0xdc, 0xf2, 0xae, 0x58,
|
|
|
|
0x46, 0x71, 0x80, 0x2e, 0x6a, 0x46, 0x7e, 0x84,
|
|
|
|
0x39, 0xca, 0xb5, 0xd6, 0x18, 0x43, 0x41, 0x6b,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0xe9, 0x27, 0x83, 0x88, 0x47, 0x80, 0x6a, 0x43,
|
|
|
|
0xbd, 0x6c, 0x60, 0x88, 0xe3, 0x9f, 0x65, 0xb8,
|
|
|
|
0xb3, 0xe5, 0x8b, 0x2d, 0xb5, 0xf7, 0xad, 0x56,
|
|
|
|
0x43, 0xd9, 0x1e, 0x06, 0x59, 0xa2, 0x8a, 0x2a,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0x0b, 0xd3, 0xa8, 0x18, 0xe8, 0x3f, 0x9c, 0xd2,
|
|
|
|
0xff, 0x4f, 0x62, 0x01, 0x1a, 0x51, 0x01, 0x76,
|
|
|
|
0xac, 0x32, 0xf5, 0x44, 0x8e, 0x6e, 0x15, 0x45,
|
|
|
|
0x15, 0x04, 0x3c, 0x59, 0x26, 0xd5, 0x1c, 0x6f,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0xce, 0x41, 0x34, 0x45, 0xe0, 0x37, 0x90, 0x49,
|
|
|
|
0x8f, 0xe7, 0x2d, 0x8e, 0x01, 0x91, 0x5e, 0x7f,
|
|
|
|
0xf1, 0x20, 0xae, 0x35, 0xb3, 0xb5, 0x90, 0xd2,
|
|
|
|
0x1b, 0x7f, 0x74, 0xde, 0xe1, 0x83, 0x0f, 0x0d,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0x60, 0x0e, 0x6f, 0x93, 0xe7, 0x3d, 0x7a, 0xbd,
|
|
|
|
0x4e, 0xe0, 0xa6, 0x5c, 0xb1, 0xb1, 0x9a, 0xa3,
|
|
|
|
0xec, 0xc5, 0x25, 0x68, 0x9d, 0xbf, 0x17, 0x77,
|
|
|
|
0x96, 0x58, 0x74, 0x1b, 0x95, 0xc1, 0x5a, 0x55,
|
|
|
|
}),
|
|
|
|
};
|
|
|
|
|
|
|
|
PedersenHash PedersenHash::EmptyRoot(size_t depth) {
|
|
|
|
return pedersen_empty_roots.at(depth);
|
|
|
|
}
|
|
|
|
|
|
|
|
SHA256Compress SHA256Compress::combine(
|
|
|
|
const SHA256Compress& a,
|
|
|
|
const SHA256Compress& b,
|
|
|
|
size_t depth
|
|
|
|
)
|
|
|
|
{
|
|
|
|
SHA256Compress res = SHA256Compress();
|
|
|
|
|
|
|
|
CSHA256 hasher;
|
|
|
|
hasher.Write(a.begin(), 32);
|
|
|
|
hasher.Write(b.begin(), 32);
|
|
|
|
hasher.FinalizeNoPadding(res.begin());
|
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const std::array<SHA256Compress, 66> sha256_empty_roots = {
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0xda, 0x56, 0x98, 0xbe, 0x17, 0xb9, 0xb4, 0x69,
|
|
|
|
0x62, 0x33, 0x57, 0x99, 0x77, 0x9f, 0xbe, 0xca,
|
|
|
|
0x8c, 0xe5, 0xd4, 0x91, 0xc0, 0xd2, 0x62, 0x43,
|
|
|
|
0xba, 0xfe, 0xf9, 0xea, 0x18, 0x37, 0xa9, 0xd8,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0xdc, 0x76, 0x6f, 0xab, 0x49, 0x2c, 0xcf, 0x3d,
|
|
|
|
0x1e, 0x49, 0xd4, 0xf3, 0x74, 0xb5, 0x23, 0x5f,
|
|
|
|
0xa5, 0x65, 0x06, 0xaa, 0xc2, 0x22, 0x4d, 0x39,
|
|
|
|
0xf9, 0x43, 0xfc, 0xd4, 0x92, 0x02, 0x97, 0x4c,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0x3f, 0x0a, 0x40, 0x61, 0x81, 0x10, 0x59, 0x68,
|
|
|
|
0xfd, 0xae, 0xe3, 0x06, 0x79, 0xe3, 0x27, 0x3c,
|
|
|
|
0x66, 0xb7, 0x2b, 0xf9, 0xa7, 0xf5, 0xde, 0xbb,
|
|
|
|
0xf3, 0xb5, 0xa0, 0xa2, 0x6e, 0x35, 0x9f, 0x92,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0x26, 0xb0, 0x05, 0x26, 0x94, 0xfc, 0x42, 0xfd,
|
|
|
|
0xff, 0x93, 0xe6, 0xfb, 0x5a, 0x71, 0xd3, 0x8c,
|
|
|
|
0x3d, 0xd7, 0xdc, 0x5b, 0x6a, 0xd7, 0x10, 0xeb,
|
|
|
|
0x04, 0x8c, 0x66, 0x02, 0x33, 0x13, 0x7f, 0xab,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0x01, 0x09, 0xec, 0xc0, 0x72, 0x26, 0x59, 0xff,
|
|
|
|
0x83, 0x45, 0x0b, 0x8f, 0x7b, 0x88, 0x46, 0xe6,
|
|
|
|
0x7b, 0x28, 0x59, 0xf3, 0x3c, 0x30, 0xd9, 0xb7,
|
|
|
|
0xac, 0xd5, 0xbf, 0x39, 0xca, 0xe5, 0x4e, 0x31,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0x3f, 0x90, 0x9b, 0x8c, 0xe3, 0xd7, 0xff, 0xd8,
|
|
|
|
0xa5, 0xb3, 0x09, 0x08, 0xf6, 0x05, 0xa0, 0x3b,
|
|
|
|
0x0d, 0xb8, 0x51, 0x69, 0x55, 0x8d, 0xdc, 0x1d,
|
|
|
|
0xa7, 0xbb, 0xbc, 0xc9, 0xb0, 0x9f, 0xd3, 0x25,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0x40, 0x46, 0x0f, 0xa6, 0xbc, 0x69, 0x2a, 0x06,
|
|
|
|
0xf4, 0x75, 0x21, 0xa6, 0x72, 0x5a, 0x54, 0x7c,
|
|
|
|
0x02, 0x8a, 0x6a, 0x24, 0x0d, 0x84, 0x09, 0xf1,
|
|
|
|
0x65, 0xe6, 0x3c, 0xb5, 0x4d, 0xa2, 0xd2, 0x3f,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0x8c, 0x08, 0x56, 0x74, 0x24, 0x9b, 0x43, 0xda,
|
|
|
|
0x1b, 0x9a, 0x31, 0xa0, 0xe8, 0x20, 0xe8, 0x1e,
|
|
|
|
0x75, 0xf3, 0x42, 0x80, 0x7b, 0x03, 0xb6, 0xb9,
|
|
|
|
0xe6, 0x49, 0x83, 0x21, 0x7b, 0xc2, 0xb3, 0x8e,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0xa0, 0x83, 0x45, 0x0c, 0x1b, 0xa2, 0xa3, 0xa7,
|
|
|
|
0xbe, 0x76, 0xfa, 0xd9, 0xd1, 0x3b, 0xc3, 0x7b,
|
|
|
|
0xe4, 0xbf, 0x83, 0xbd, 0x3e, 0x59, 0xfc, 0x37,
|
|
|
|
0x5a, 0x36, 0xba, 0x62, 0xdc, 0x62, 0x02, 0x98,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0x1d, 0xdd, 0xda, 0xbc, 0x2c, 0xaa, 0x2d, 0xe9,
|
|
|
|
0xef, 0xf9, 0xe1, 0x8c, 0x8c, 0x5a, 0x39, 0x40,
|
|
|
|
0x6d, 0x79, 0x36, 0xe8, 0x89, 0xbc, 0x16, 0xcf,
|
|
|
|
0xab, 0xb1, 0x44, 0xf5, 0xc0, 0x02, 0x26, 0x82,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0xc2, 0x2d, 0x8f, 0x0b, 0x5e, 0x40, 0x56, 0xe5,
|
|
|
|
0xf3, 0x18, 0xba, 0x22, 0x09, 0x1c, 0xc0, 0x7d,
|
|
|
|
0xb5, 0x69, 0x4f, 0xbe, 0xb5, 0xe8, 0x7e, 0xf0,
|
|
|
|
0xd7, 0xe2, 0xc5, 0x7c, 0xa3, 0x52, 0x35, 0x9e,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0x89, 0xa4, 0x34, 0xae, 0x1f, 0xeb, 0xd7, 0x68,
|
|
|
|
0x7e, 0xce, 0xea, 0x21, 0xd0, 0x7f, 0x20, 0xa2,
|
|
|
|
0x51, 0x24, 0x49, 0xd0, 0x8c, 0xe2, 0xee, 0xe5,
|
|
|
|
0x58, 0x71, 0xcd, 0xb9, 0xd4, 0x6c, 0x12, 0x33,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0x73, 0x33, 0xdb, 0xff, 0xbd, 0x11, 0xf0, 0x92,
|
|
|
|
0x47, 0xa2, 0xb3, 0x3a, 0x01, 0x3e, 0xc4, 0xc4,
|
|
|
|
0x34, 0x20, 0x29, 0xd8, 0x51, 0xe2, 0x2b, 0xa4,
|
|
|
|
0x85, 0xd4, 0x46, 0x18, 0x51, 0x37, 0x0c, 0x15,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0x5d, 0xad, 0x84, 0x4a, 0xb9, 0x46, 0x6b, 0x70,
|
|
|
|
0xf7, 0x45, 0x13, 0x71, 0x95, 0xca, 0x22, 0x1b,
|
|
|
|
0x48, 0xf3, 0x46, 0xab, 0xd1, 0x45, 0xfb, 0x5e,
|
|
|
|
0xfc, 0x23, 0xa8, 0xb4, 0xba, 0x50, 0x80, 0x22,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0x50, 0x7e, 0x0d, 0xae, 0x81, 0xcb, 0xfb, 0xe4,
|
|
|
|
0x57, 0xfd, 0x37, 0x0e, 0xf1, 0xca, 0x42, 0x01,
|
|
|
|
0xc2, 0xb6, 0x40, 0x10, 0x83, 0xdd, 0xab, 0x44,
|
|
|
|
0x0e, 0x4a, 0x03, 0x8d, 0xc1, 0xe3, 0x58, 0xc4,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0xbd, 0xcd, 0xb3, 0x29, 0x31, 0x88, 0xc9, 0x80,
|
|
|
|
0x7d, 0x80, 0x82, 0x67, 0x01, 0x86, 0x84, 0xcf,
|
|
|
|
0xec, 0xe0, 0x7a, 0xc3, 0x5a, 0x42, 0xc0, 0x0f,
|
|
|
|
0x2c, 0x79, 0xb4, 0x00, 0x38, 0x25, 0x30, 0x5d,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0xba, 0xb5, 0x80, 0x09, 0x72, 0xa1, 0x6c, 0x2c,
|
|
|
|
0x22, 0x53, 0x0c, 0x66, 0x06, 0x6d, 0x0a, 0x58,
|
|
|
|
0x67, 0xe9, 0x87, 0xbe, 0xd2, 0x1a, 0x6d, 0x5a,
|
|
|
|
0x45, 0x0b, 0x68, 0x3c, 0xf1, 0xcf, 0xd7, 0x09,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0x11, 0xaa, 0x0b, 0x4a, 0xd2, 0x9b, 0x13, 0xb0,
|
|
|
|
0x57, 0xa3, 0x16, 0x19, 0xd6, 0x50, 0x0d, 0x63,
|
|
|
|
0x6c, 0xd7, 0x35, 0xcd, 0xd0, 0x7d, 0x81, 0x1e,
|
|
|
|
0xa2, 0x65, 0xec, 0x4b, 0xcb, 0xbb, 0xd0, 0x58,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0x51, 0x45, 0xb1, 0xb0, 0x55, 0xc2, 0xdf, 0x02,
|
|
|
|
0xb9, 0x56, 0x75, 0xe3, 0x79, 0x7b, 0x91, 0xde,
|
|
|
|
0x1b, 0x84, 0x6d, 0x25, 0x00, 0x3c, 0x0a, 0x80,
|
|
|
|
0x3d, 0x08, 0x90, 0x07, 0x28, 0xf2, 0xcd, 0x6a,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0x03, 0x23, 0xf2, 0x85, 0x0b, 0xf3, 0x44, 0x4f,
|
|
|
|
0x4b, 0x4c, 0x5c, 0x09, 0xa6, 0x05, 0x7e, 0xc7,
|
|
|
|
0x16, 0x91, 0x90, 0xf4, 0x5a, 0xcb, 0x9e, 0x46,
|
|
|
|
0x98, 0x4a, 0xb3, 0xdf, 0xce, 0xc4, 0xf0, 0x6a,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0x67, 0x15, 0x46, 0xe2, 0x6b, 0x1d, 0xa1, 0xaf,
|
|
|
|
0x75, 0x45, 0x31, 0xe2, 0x6d, 0x8a, 0x6a, 0x51,
|
|
|
|
0x07, 0x3a, 0x57, 0xdd, 0xd7, 0x2d, 0xc4, 0x72,
|
|
|
|
0xef, 0xb4, 0x3f, 0xcb, 0x25, 0x7c, 0xff, 0xff,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0xbb, 0x23, 0xa9, 0xbb, 0xa5, 0x6d, 0xe5, 0x7c,
|
|
|
|
0xb2, 0x84, 0xb0, 0xd2, 0xb0, 0x1c, 0x64, 0x2c,
|
|
|
|
0xf7, 0x9c, 0x9a, 0x55, 0x63, 0xf0, 0x06, 0x7a,
|
|
|
|
0x21, 0x29, 0x24, 0x12, 0x14, 0x5b, 0xd7, 0x8a,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0xf3, 0x0c, 0xc8, 0x36, 0xb9, 0xf7, 0x1b, 0x4e,
|
|
|
|
0x7e, 0xe3, 0xc7, 0x2b, 0x1f, 0xd2, 0x53, 0x26,
|
|
|
|
0x8a, 0xf9, 0xa2, 0x7e, 0x9d, 0x72, 0x91, 0xa2,
|
|
|
|
0x3d, 0x02, 0x82, 0x1b, 0x21, 0xdd, 0xfd, 0x16,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0x58, 0xa2, 0x75, 0x3d, 0xad, 0xe1, 0x03, 0xce,
|
|
|
|
0xcb, 0xcd, 0xa5, 0x0b, 0x5e, 0xbf, 0xce, 0x31,
|
|
|
|
0xe1, 0x2d, 0x41, 0xd5, 0x84, 0x1d, 0xcc, 0x95,
|
|
|
|
0x62, 0x0f, 0x7b, 0x3d, 0x50, 0xa1, 0xb9, 0xa1,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0x92, 0x5e, 0x6d, 0x47, 0x4a, 0x5d, 0x8d, 0x30,
|
|
|
|
0x04, 0xf2, 0x9d, 0xa0, 0xdd, 0x78, 0xd3, 0x0a,
|
|
|
|
0xe3, 0x82, 0x4c, 0xe7, 0x9d, 0xfe, 0x49, 0x34,
|
|
|
|
0xbb, 0x29, 0xec, 0x3a, 0xfa, 0xf3, 0xd5, 0x21,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0x08, 0xf2, 0x79, 0x61, 0x86, 0x16, 0xbc, 0xdd,
|
|
|
|
0x4e, 0xad, 0xc9, 0xc7, 0xa9, 0x06, 0x26, 0x91,
|
|
|
|
0xa5, 0x9b, 0x43, 0xb0, 0x7e, 0x2c, 0x1e, 0x23,
|
|
|
|
0x7f, 0x17, 0xbd, 0x18, 0x9c, 0xd6, 0xa8, 0xfe,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0xc9, 0x2b, 0x32, 0xdb, 0x42, 0xf4, 0x2e, 0x2b,
|
|
|
|
0xf0, 0xa5, 0x9d, 0xf9, 0x05, 0x5b, 0xe5, 0xc6,
|
|
|
|
0x69, 0xd3, 0x24, 0x2d, 0xf4, 0x53, 0x57, 0x65,
|
|
|
|
0x9b, 0x75, 0xae, 0x2c, 0x27, 0xa7, 0x6f, 0x50,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0xc0, 0xdb, 0x2a, 0x74, 0x99, 0x8c, 0x50, 0xeb,
|
|
|
|
0x7b, 0xa6, 0x53, 0x4f, 0x6d, 0x41, 0x0e, 0xfc,
|
|
|
|
0x27, 0xc4, 0xbb, 0x88, 0xac, 0xb0, 0x22, 0x2c,
|
|
|
|
0x79, 0x06, 0xea, 0x28, 0xa3, 0x27, 0xb5, 0x11,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0xd7, 0xc6, 0x12, 0xc8, 0x17, 0x79, 0x31, 0x91,
|
|
|
|
0xa1, 0xe6, 0x86, 0x52, 0x12, 0x18, 0x76, 0xd6,
|
|
|
|
0xb3, 0xbd, 0xe4, 0x0f, 0x4f, 0xa5, 0x2b, 0xc3,
|
|
|
|
0x14, 0x14, 0x5c, 0xe6, 0xe5, 0xcd, 0xd2, 0x59,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0xb2, 0x23, 0x70, 0x10, 0x6c, 0x67, 0xa1, 0x72,
|
|
|
|
0x09, 0xf6, 0x13, 0x0b, 0xc0, 0x9f, 0x73, 0x5d,
|
|
|
|
0x83, 0xaa, 0x2c, 0x04, 0xfc, 0x4f, 0xe7, 0x2e,
|
|
|
|
0xa5, 0xd8, 0x0b, 0x21, 0x67, 0x23, 0xe7, 0xce,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0x9f, 0x67, 0xd5, 0xf6, 0x64, 0x66, 0x4c, 0x90,
|
|
|
|
0x19, 0x40, 0xee, 0xe3, 0xd0, 0x2d, 0xd5, 0xb3,
|
|
|
|
0xe4, 0xb9, 0x2e, 0x7b, 0x42, 0x82, 0x0c, 0x42,
|
|
|
|
0xfc, 0x51, 0x59, 0xe9, 0x1b, 0x41, 0x17, 0x2a,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0xac, 0x58, 0xcd, 0x13, 0x88, 0xfe, 0xc2, 0x90,
|
|
|
|
0xd3, 0x98, 0xf1, 0x94, 0x4b, 0x56, 0x44, 0x49,
|
|
|
|
0xa6, 0x3c, 0x81, 0x58, 0x80, 0x56, 0x6b, 0xd1,
|
|
|
|
0xd1, 0x89, 0xf7, 0x83, 0x9e, 0x3b, 0x0c, 0x8c,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0x56, 0x98, 0xea, 0xe7, 0xc8, 0x51, 0x5e, 0xd0,
|
|
|
|
0x5a, 0x70, 0x33, 0x9b, 0xdf, 0x7c, 0x10, 0x28,
|
|
|
|
0xe7, 0xac, 0xca, 0x13, 0xa4, 0xfa, 0x97, 0xd9,
|
|
|
|
0x53, 0x8f, 0x01, 0xac, 0x8d, 0x88, 0x9a, 0xe3,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0x2d, 0x49, 0x95, 0x77, 0x0a, 0x76, 0xfb, 0x93,
|
|
|
|
0x31, 0x4c, 0xa7, 0x4b, 0x35, 0x24, 0xea, 0x1d,
|
|
|
|
0xb5, 0x68, 0x8a, 0xd0, 0xa7, 0x61, 0x83, 0xea,
|
|
|
|
0x17, 0x20, 0x4a, 0x8f, 0x02, 0x4a, 0x9f, 0x3b,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0x5e, 0x89, 0x92, 0xc1, 0xb0, 0x72, 0xc1, 0x6e,
|
|
|
|
0x9e, 0x28, 0xa8, 0x53, 0x58, 0xfb, 0x5f, 0xb6,
|
|
|
|
0x90, 0x1a, 0x81, 0x58, 0x77, 0x66, 0xda, 0xdb,
|
|
|
|
0x7a, 0xa0, 0xb9, 0x73, 0xde, 0xd2, 0xf2, 0x64,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0xe9, 0x5d, 0xb7, 0x1e, 0x1f, 0x72, 0x91, 0xba,
|
|
|
|
0x54, 0x99, 0x46, 0x1b, 0xc7, 0x15, 0x20, 0x3e,
|
|
|
|
0x29, 0xb8, 0x4b, 0xfa, 0x42, 0x83, 0xe3, 0xbb,
|
|
|
|
0x7f, 0x47, 0x0a, 0x15, 0xd0, 0xe1, 0x58, 0x4e,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0x41, 0xf0, 0x78, 0xbd, 0x18, 0x24, 0xc8, 0xa4,
|
|
|
|
0xb7, 0x19, 0x64, 0xf3, 0x94, 0xaa, 0x59, 0x50,
|
|
|
|
0x84, 0xd8, 0xeb, 0x17, 0xb9, 0x7a, 0x36, 0x30,
|
|
|
|
0x43, 0x3a, 0xf7, 0x0d, 0x10, 0xe0, 0xef, 0xf6,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0xa1, 0x91, 0x3f, 0xe6, 0xb2, 0x01, 0x32, 0x31,
|
|
|
|
0x2f, 0x8c, 0x1f, 0x00, 0xdd, 0xd6, 0x3c, 0xec,
|
|
|
|
0x7a, 0x03, 0xf5, 0xf1, 0xd7, 0xd8, 0x34, 0x92,
|
|
|
|
0xfa, 0x28, 0x4c, 0x0b, 0x5d, 0x63, 0x20, 0xb0,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0xba, 0x94, 0x40, 0xc4, 0xdb, 0xfc, 0xf5, 0x5c,
|
|
|
|
0xeb, 0x60, 0x5a, 0x5b, 0x89, 0x90, 0xfc, 0x11,
|
|
|
|
0xf8, 0xef, 0x22, 0x87, 0x0d, 0x8d, 0x12, 0xe1,
|
|
|
|
0x30, 0xf9, 0x86, 0x49, 0x1e, 0xae, 0x84, 0xb3,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0x49, 0xdb, 0x2d, 0x5e, 0x22, 0xb8, 0x01, 0x5c,
|
|
|
|
0xae, 0x48, 0x10, 0xd7, 0x5e, 0x54, 0x01, 0x4c,
|
|
|
|
0x54, 0x69, 0x86, 0x27, 0x38, 0xe1, 0x61, 0xec,
|
|
|
|
0x96, 0xec, 0x20, 0x21, 0x87, 0x18, 0x82, 0x8a,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0xd4, 0x85, 0x1f, 0xb8, 0x43, 0x1e, 0xdf, 0xbb,
|
|
|
|
0x8b, 0x1e, 0x85, 0xad, 0xa6, 0x89, 0x59, 0x67,
|
|
|
|
0xc2, 0xda, 0xc8, 0x7d, 0xf3, 0x44, 0x99, 0x2a,
|
|
|
|
0x05, 0xfa, 0xf1, 0xec, 0xf8, 0x36, 0xee, 0xc9,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0xe4, 0xab, 0x9f, 0x44, 0x70, 0xf0, 0x0c, 0xd1,
|
|
|
|
0x96, 0xd4, 0x7c, 0x75, 0xc8, 0x2e, 0x7a, 0xda,
|
|
|
|
0xf0, 0x6f, 0xe1, 0x7e, 0x04, 0x2e, 0x39, 0x53,
|
|
|
|
0xd9, 0x3b, 0xb5, 0xd5, 0x6d, 0x8c, 0xd8, 0xfb,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0x7e, 0x43, 0x20, 0x43, 0x48, 0x49, 0xec, 0xb3,
|
|
|
|
0x57, 0xf1, 0xaf, 0xaa, 0xba, 0x21, 0xa5, 0x44,
|
|
|
|
0x00, 0xef, 0x2d, 0x11, 0xcf, 0xf8, 0x3b, 0x93,
|
|
|
|
0x7d, 0x87, 0xfd, 0xaf, 0xa4, 0x9f, 0x81, 0x99,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0x02, 0x0a, 0xdc, 0x98, 0xd9, 0x6c, 0xfb, 0xbc,
|
|
|
|
0xca, 0x15, 0xfc, 0x3a, 0xa0, 0x37, 0x60, 0xed,
|
|
|
|
0x28, 0x66, 0x86, 0xc3, 0x5b, 0x5d, 0x92, 0xc7,
|
|
|
|
0xcb, 0x64, 0xa9, 0x99, 0xb3, 0x94, 0xa8, 0x54,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0x3a, 0x26, 0xb2, 0x9f, 0xe1, 0xac, 0xfd, 0xd6,
|
|
|
|
0xc6, 0xa1, 0x51, 0xbc, 0xc3, 0xdb, 0xcb, 0x95,
|
|
|
|
0xa1, 0x0e, 0xbe, 0x2f, 0x05, 0x53, 0xf8, 0x07,
|
|
|
|
0x79, 0x56, 0x9b, 0x67, 0xb7, 0x24, 0x4e, 0x77,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0xec, 0x2d, 0x09, 0x86, 0xe6, 0xa0, 0xdd, 0xf4,
|
|
|
|
0x38, 0x97, 0xb2, 0xd4, 0xf2, 0x3b, 0xb0, 0x34,
|
|
|
|
0xf5, 0x38, 0xff, 0xe0, 0x08, 0x27, 0xf3, 0x10,
|
|
|
|
0xdc, 0x49, 0x63, 0xf3, 0x26, 0x7f, 0x0b, 0xfb,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0xd4, 0x80, 0x73, 0xf8, 0x81, 0x9f, 0x81, 0xf0,
|
|
|
|
0x35, 0x8e, 0x3f, 0xc3, 0x5a, 0x04, 0x7c, 0xc7,
|
|
|
|
0x40, 0x82, 0xae, 0x1c, 0xb7, 0xee, 0x22, 0xfb,
|
|
|
|
0x60, 0x9c, 0x01, 0x64, 0x93, 0x42, 0xd0, 0xe6,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0xad, 0x80, 0x37, 0x60, 0x17, 0x93, 0xf1, 0x72,
|
|
|
|
0x44, 0x1e, 0xcb, 0x00, 0xdc, 0x13, 0x8d, 0x9f,
|
|
|
|
0xc5, 0x95, 0x71, 0x25, 0xec, 0xc3, 0x82, 0xec,
|
|
|
|
0x65, 0xe3, 0x6f, 0x81, 0x7d, 0xc7, 0x99, 0xfb,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0xca, 0x50, 0x0a, 0x54, 0x41, 0xf3, 0x6f, 0x4d,
|
|
|
|
0xf6, 0x73, 0xd6, 0xb8, 0xed, 0x07, 0x5d, 0x36,
|
|
|
|
0xda, 0xe2, 0xc7, 0xe6, 0x48, 0x14, 0x28, 0xc7,
|
|
|
|
0x0a, 0x5a, 0x76, 0xb7, 0xa9, 0xbe, 0xbc, 0xe8,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0x42, 0x2b, 0x6d, 0xdd, 0x47, 0x32, 0x31, 0xdc,
|
|
|
|
0x4d, 0x56, 0xfe, 0x91, 0x34, 0x44, 0xcc, 0xd5,
|
|
|
|
0x6f, 0x7c, 0x61, 0xf7, 0x47, 0xba, 0x57, 0xca,
|
|
|
|
0x94, 0x6d, 0x5f, 0xef, 0x72, 0xd8, 0x40, 0xa0,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0xab, 0x41, 0xf4, 0xec, 0xb7, 0xd7, 0x08, 0x96,
|
|
|
|
0x15, 0x80, 0x0e, 0x19, 0xfc, 0xc5, 0x3b, 0x83,
|
|
|
|
0x79, 0xed, 0x05, 0xee, 0x35, 0xc8, 0x25, 0x67,
|
|
|
|
0x09, 0x55, 0x83, 0xfd, 0x90, 0xff, 0x30, 0x35,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0xbb, 0xf7, 0x61, 0x82, 0x48, 0x35, 0x4c, 0xeb,
|
|
|
|
0x1b, 0xc1, 0xfc, 0x9d, 0xbc, 0x42, 0xc4, 0x26,
|
|
|
|
0xa4, 0xe2, 0xc1, 0xe0, 0xd4, 0x43, 0xc5, 0x68,
|
|
|
|
0x3a, 0x92, 0x56, 0xc6, 0x2e, 0xcd, 0xc2, 0x6f,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0xe5, 0x0a, 0xe7, 0x14, 0x79, 0xfc, 0x8e, 0xc5,
|
|
|
|
0x69, 0x19, 0x2a, 0x13, 0x07, 0x2e, 0x01, 0x1a,
|
|
|
|
0xfc, 0x24, 0x9f, 0x47, 0x1a, 0xf0, 0x95, 0x00,
|
|
|
|
0xea, 0x39, 0xf7, 0x5d, 0x0a, 0xf8, 0x56, 0xbf,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0xe7, 0x4c, 0x0b, 0x92, 0x20, 0x14, 0x7d, 0xb2,
|
|
|
|
0xd5, 0x0a, 0x3b, 0x58, 0xd4, 0x13, 0x77, 0x5d,
|
|
|
|
0x16, 0xc9, 0x84, 0x69, 0x0b, 0xe7, 0xd9, 0x0f,
|
|
|
|
0x0b, 0xc4, 0x3d, 0x99, 0xdb, 0xa1, 0xb6, 0x89,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0x29, 0x32, 0x4a, 0x0a, 0x48, 0xd1, 0x16, 0x57,
|
|
|
|
0xa5, 0x1b, 0xa0, 0x8b, 0x00, 0x48, 0x79, 0xbf,
|
|
|
|
0xcf, 0xc6, 0x6a, 0x1a, 0xcb, 0x7c, 0xe3, 0x6d,
|
|
|
|
0xfe, 0x47, 0x8d, 0x26, 0x55, 0x48, 0x4b, 0x48,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0x88, 0x95, 0x2e, 0x3d, 0x0a, 0xc0, 0x6c, 0xb1,
|
|
|
|
0x6b, 0x66, 0x52, 0x01, 0x12, 0x22, 0x49, 0x65,
|
|
|
|
0x9a, 0x22, 0x32, 0x5e, 0x01, 0xc8, 0x70, 0xf4,
|
|
|
|
0x9e, 0x29, 0xda, 0x6b, 0x17, 0x57, 0xe0, 0x82,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0xcd, 0xf8, 0x79, 0xf2, 0x43, 0x5b, 0x95, 0xaf,
|
|
|
|
0x04, 0x2a, 0x3b, 0xf7, 0xb8, 0x50, 0xf7, 0x81,
|
|
|
|
0x92, 0x46, 0xc8, 0x05, 0x28, 0x58, 0x03, 0xd6,
|
|
|
|
0x7f, 0xfb, 0xf4, 0xf2, 0x95, 0xbe, 0xd0, 0x04,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0xe0, 0x05, 0xe3, 0x24, 0x20, 0x0b, 0x4f, 0x42,
|
|
|
|
0x8c, 0x62, 0xbc, 0x33, 0x31, 0xe6, 0x95, 0xc3,
|
|
|
|
0x73, 0x60, 0x7c, 0xd0, 0xfa, 0xa9, 0x79, 0x03,
|
|
|
|
0x41, 0xfa, 0x3b, 0xa1, 0xed, 0x22, 0x8b, 0xc5,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0x35, 0x44, 0x47, 0x72, 0x7a, 0xa9, 0xa5, 0x3d,
|
|
|
|
0xd8, 0x34, 0x5b, 0x6b, 0x6c, 0x69, 0x34, 0x43,
|
|
|
|
0xe5, 0x6e, 0xf4, 0xae, 0xba, 0x13, 0xc4, 0x10,
|
|
|
|
0x17, 0x9f, 0xc8, 0x58, 0x9e, 0x77, 0x33, 0xd5,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0xda, 0x52, 0xdd, 0xa9, 0x1f, 0x28, 0x29, 0xc1,
|
|
|
|
0x5c, 0x0e, 0x58, 0xd2, 0x9a, 0x95, 0x36, 0x0b,
|
|
|
|
0x86, 0xab, 0x30, 0xcf, 0x0c, 0xac, 0x81, 0x01,
|
|
|
|
0x83, 0x2a, 0x29, 0xf3, 0x8c, 0x31, 0x85, 0xf1,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0xc7, 0xda, 0x78, 0x14, 0xe2, 0x28, 0xe1, 0x14,
|
|
|
|
0x44, 0x11, 0xd7, 0x8b, 0x53, 0x60, 0x92, 0xfe,
|
|
|
|
0x92, 0x0b, 0xcd, 0xfc, 0xc3, 0x6c, 0xf1, 0x9d,
|
|
|
|
0x12, 0x59, 0x04, 0x7b, 0x26, 0x7d, 0x58, 0xb5,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0xab, 0xa1, 0xf6, 0x8b, 0x6c, 0x2b, 0x4d, 0xb6,
|
|
|
|
0xcc, 0x06, 0xa7, 0x34, 0x0e, 0x12, 0x31, 0x3c,
|
|
|
|
0x4b, 0x4a, 0x4e, 0xa6, 0xde, 0xb1, 0x7d, 0xeb,
|
|
|
|
0x3e, 0x1e, 0x66, 0xcd, 0x8e, 0xac, 0xf3, 0x2b,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0xc1, 0x60, 0xae, 0x4f, 0x64, 0xab, 0x76, 0x4d,
|
|
|
|
0x86, 0x4a, 0x52, 0xad, 0x5e, 0x33, 0x12, 0x6c,
|
|
|
|
0x4b, 0x5c, 0xe1, 0x05, 0xa4, 0x7d, 0xee, 0xdd,
|
|
|
|
0x75, 0xbc, 0x70, 0x19, 0x9a, 0x52, 0x47, 0xef,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0xea, 0xdf, 0x23, 0xfc, 0x99, 0xd5, 0x14, 0xdd,
|
|
|
|
0x8e, 0xa2, 0x04, 0xd2, 0x23, 0xe9, 0x8d, 0xa9,
|
|
|
|
0x88, 0x83, 0x1f, 0x9b, 0x5d, 0x19, 0x40, 0x27,
|
|
|
|
0x4c, 0xa5, 0x20, 0xb7, 0xfb, 0x17, 0x3d, 0x8a,
|
|
|
|
}),
|
|
|
|
uint256(std::vector<unsigned char>{
|
|
|
|
0x5b, 0x8e, 0x14, 0xfa, 0xca, 0xc8, 0xa7, 0xc7,
|
|
|
|
0xa3, 0xbf, 0xee, 0x8b, 0xae, 0x71, 0xf2, 0xf7,
|
|
|
|
0x79, 0x3d, 0x3a, 0xd5, 0xfe, 0x33, 0x83, 0xf9,
|
|
|
|
0x3a, 0xb6, 0x06, 0x1f, 0x2a, 0x11, 0xbb, 0x02
|
|
|
|
}),
|
|
|
|
};
|
|
|
|
|
|
|
|
SHA256Compress SHA256Compress::EmptyRoot(size_t depth) {
|
|
|
|
return sha256_empty_roots.at(depth);
|
|
|
|
}
|
|
|
|
|
|
|
|
template <size_t Depth, typename Hash>
|
|
|
|
class PathFiller {
|
|
|
|
private:
|
|
|
|
std::deque<Hash> queue;
|
|
|
|
static EmptyMerkleRoots<Depth, Hash> emptyroots;
|
|
|
|
public:
|
|
|
|
PathFiller() : queue() { }
|
|
|
|
PathFiller(std::deque<Hash> queue) : queue(queue) { }
|
|
|
|
|
|
|
|
Hash next(size_t depth) {
|
|
|
|
if (queue.size() > 0) {
|
|
|
|
Hash h = queue.front();
|
|
|
|
queue.pop_front();
|
|
|
|
|
|
|
|
return h;
|
|
|
|
} else {
|
|
|
|
return emptyroots.empty_root(depth);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
template<size_t Depth, typename Hash>
|
|
|
|
EmptyMerkleRoots<Depth, Hash> PathFiller<Depth, Hash>::emptyroots;
|
|
|
|
|
|
|
|
template<size_t Depth, typename Hash>
|
|
|
|
void IncrementalMerkleTree<Depth, Hash>::wfcheck() const {
|
|
|
|
if (parents.size() >= Depth) {
|
|
|
|
throw std::ios_base::failure("tree has too many parents");
|
|
|
|
}
|
|
|
|
|
|
|
|
// The last parent cannot be null.
|
|
|
|
if (!(parents.empty()) && !(parents.back())) {
|
|
|
|
throw std::ios_base::failure("tree has non-canonical representation of parent");
|
|
|
|
}
|
|
|
|
|
|
|
|
// Left cannot be empty when right exists.
|
|
|
|
if (!left && right) {
|
|
|
|
throw std::ios_base::failure("tree has non-canonical representation; right should not exist");
|
|
|
|
}
|
|
|
|
|
|
|
|
// Left cannot be empty when parents is nonempty.
|
|
|
|
if (!left && parents.size() > 0) {
|
|
|
|
throw std::ios_base::failure("tree has non-canonical representation; parents should not be unempty");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
template<size_t Depth, typename Hash>
|
|
|
|
Hash IncrementalMerkleTree<Depth, Hash>::last() const {
|
|
|
|
if (right) {
|
|
|
|
return *right;
|
|
|
|
} else if (left) {
|
|
|
|
return *left;
|
|
|
|
} else {
|
|
|
|
throw std::runtime_error("tree has no cursor");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
template<size_t Depth, typename Hash>
|
|
|
|
size_t IncrementalMerkleTree<Depth, Hash>::size() const {
|
|
|
|
size_t ret = 0;
|
|
|
|
if (left) {
|
|
|
|
ret++;
|
|
|
|
}
|
|
|
|
if (right) {
|
|
|
|
ret++;
|
|
|
|
}
|
|
|
|
// Treat occupation of parents array as a binary number
|
|
|
|
// (right-shifted by 1)
|
|
|
|
for (size_t i = 0; i < parents.size(); i++) {
|
|
|
|
if (parents[i]) {
|
|
|
|
ret += (1 << (i+1));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
template<size_t Depth, typename Hash>
|
|
|
|
void IncrementalMerkleTree<Depth, Hash>::append(Hash obj) {
|
|
|
|
if (is_complete(Depth)) {
|
|
|
|
throw std::runtime_error("tree is full");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!left) {
|
|
|
|
// Set the left leaf
|
|
|
|
left = obj;
|
|
|
|
} else if (!right) {
|
|
|
|
// Set the right leaf
|
|
|
|
right = obj;
|
|
|
|
} else {
|
|
|
|
// Combine the leaves and propagate it up the tree
|
|
|
|
boost::optional<Hash> combined = Hash::combine(*left, *right, 0);
|
|
|
|
|
|
|
|
// Set the "left" leaf to the object and make the "right" leaf none
|
|
|
|
left = obj;
|
|
|
|
right = boost::none;
|
|
|
|
|
|
|
|
for (size_t i = 0; i < Depth; i++) {
|
|
|
|
if (i < parents.size()) {
|
|
|
|
if (parents[i]) {
|
|
|
|
combined = Hash::combine(*parents[i], *combined, i+1);
|
|
|
|
parents[i] = boost::none;
|
|
|
|
} else {
|
|
|
|
parents[i] = *combined;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
parents.push_back(combined);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// This is for allowing the witness to determine if a subtree has filled
|
|
|
|
// to a particular depth, or for append() to ensure we're not appending
|
|
|
|
// to a full tree.
|
|
|
|
template<size_t Depth, typename Hash>
|
|
|
|
bool IncrementalMerkleTree<Depth, Hash>::is_complete(size_t depth) const {
|
|
|
|
if (!left || !right) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (parents.size() != (depth - 1)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOST_FOREACH(const boost::optional<Hash>& parent, parents) {
|
|
|
|
if (!parent) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// This finds the next "depth" of an unfilled subtree, given that we've filled
|
|
|
|
// `skip` uncles/subtrees.
|
|
|
|
template<size_t Depth, typename Hash>
|
|
|
|
size_t IncrementalMerkleTree<Depth, Hash>::next_depth(size_t skip) const {
|
|
|
|
if (!left) {
|
|
|
|
if (skip) {
|
|
|
|
skip--;
|
|
|
|
} else {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!right) {
|
|
|
|
if (skip) {
|
|
|
|
skip--;
|
|
|
|
} else {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
size_t d = 1;
|
|
|
|
|
|
|
|
BOOST_FOREACH(const boost::optional<Hash>& parent, parents) {
|
|
|
|
if (!parent) {
|
|
|
|
if (skip) {
|
|
|
|
skip--;
|
|
|
|
} else {
|
|
|
|
return d;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
d++;
|
|
|
|
}
|
|
|
|
|
|
|
|
return d + skip;
|
|
|
|
}
|
|
|
|
|
|
|
|
// This calculates the root of the tree.
|
|
|
|
template<size_t Depth, typename Hash>
|
|
|
|
Hash IncrementalMerkleTree<Depth, Hash>::root(size_t depth,
|
|
|
|
std::deque<Hash> filler_hashes) const {
|
|
|
|
//fprintf(stderr,"%s: depth=%d\n",__func__,depth);
|
|
|
|
PathFiller<Depth, Hash> filler(filler_hashes);
|
|
|
|
|
|
|
|
Hash combine_left = left ? *left : filler.next(0);
|
|
|
|
Hash combine_right = right ? *right : filler.next(0);
|
|
|
|
|
|
|
|
Hash root = Hash::combine(combine_left, combine_right, 0);
|
|
|
|
|
|
|
|
size_t d = 1;
|
|
|
|
|
|
|
|
BOOST_FOREACH(const boost::optional<Hash>& parent, parents) {
|
|
|
|
if (parent) {
|
|
|
|
root = Hash::combine(*parent, root, d);
|
|
|
|
} else {
|
|
|
|
root = Hash::combine(root, filler.next(d), d);
|
|
|
|
}
|
|
|
|
|
|
|
|
d++;
|
|
|
|
}
|
|
|
|
|
|
|
|
// We may not have parents for ancestor trees, so we fill
|
|
|
|
// the rest in here.
|
|
|
|
while (d < depth) {
|
|
|
|
root = Hash::combine(root, filler.next(d), d);
|
|
|
|
d++;
|
|
|
|
}
|
|
|
|
|
|
|
|
return root;
|
|
|
|
}
|
|
|
|
|
|
|
|
// This constructs an authentication path into the tree in the format that the circuit
|
|
|
|
// wants. The caller provides `filler_hashes` to fill in the uncle subtrees.
|
|
|
|
template<size_t Depth, typename Hash>
|
|
|
|
MerklePath IncrementalMerkleTree<Depth, Hash>::path(std::deque<Hash> filler_hashes) const {
|
|
|
|
if (!left) {
|
|
|
|
throw std::runtime_error("can't create an authentication path for the beginning of the tree");
|
|
|
|
}
|
|
|
|
|
|
|
|
PathFiller<Depth, Hash> filler(filler_hashes);
|
|
|
|
|
|
|
|
std::vector<Hash> path;
|
|
|
|
std::vector<bool> index;
|
|
|
|
|
|
|
|
if (right) {
|
|
|
|
index.push_back(true);
|
|
|
|
path.push_back(*left);
|
|
|
|
} else {
|
|
|
|
index.push_back(false);
|
|
|
|
path.push_back(filler.next(0));
|
|
|
|
}
|
|
|
|
|
|
|
|
size_t d = 1;
|
|
|
|
|
|
|
|
BOOST_FOREACH(const boost::optional<Hash>& parent, parents) {
|
|
|
|
if (parent) {
|
|
|
|
index.push_back(true);
|
|
|
|
path.push_back(*parent);
|
|
|
|
} else {
|
|
|
|
index.push_back(false);
|
|
|
|
path.push_back(filler.next(d));
|
|
|
|
}
|
|
|
|
|
|
|
|
d++;
|
|
|
|
}
|
|
|
|
|
|
|
|
while (d < Depth) {
|
|
|
|
index.push_back(false);
|
|
|
|
path.push_back(filler.next(d));
|
|
|
|
d++;
|
|
|
|
}
|
|
|
|
|
|
|
|
std::vector<std::vector<bool>> merkle_path;
|
|
|
|
BOOST_FOREACH(Hash b, path)
|
|
|
|
{
|
|
|
|
std::vector<unsigned char> hashv(b.begin(), b.end());
|
|
|
|
|
|
|
|
merkle_path.push_back(convertBytesVectorToVector(hashv));
|
|
|
|
}
|
|
|
|
|
|
|
|
std::reverse(merkle_path.begin(), merkle_path.end());
|
|
|
|
std::reverse(index.begin(), index.end());
|
|
|
|
|
|
|
|
return MerklePath(merkle_path, index);
|
|
|
|
}
|
|
|
|
|
|
|
|
template<size_t Depth, typename Hash>
|
|
|
|
std::deque<Hash> IncrementalWitness<Depth, Hash>::partial_path() const {
|
|
|
|
std::deque<Hash> uncles(filled.begin(), filled.end());
|
|
|
|
|
|
|
|
if (cursor) {
|
|
|
|
uncles.push_back(cursor->root(cursor_depth));
|
|
|
|
}
|
|
|
|
|
|
|
|
return uncles;
|
|
|
|
}
|
|
|
|
|
|
|
|
template<size_t Depth, typename Hash>
|
|
|
|
void IncrementalWitness<Depth, Hash>::append(Hash obj) {
|
|
|
|
if (cursor) {
|
|
|
|
cursor->append(obj);
|
|
|
|
|
|
|
|
if (cursor->is_complete(cursor_depth)) {
|
|
|
|
filled.push_back(cursor->root(cursor_depth));
|
|
|
|
cursor = boost::none;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
cursor_depth = tree.next_depth(filled.size());
|
|
|
|
|
|
|
|
if (cursor_depth >= Depth) {
|
|
|
|
throw std::runtime_error("tree is full");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (cursor_depth == 0) {
|
|
|
|
filled.push_back(obj);
|
|
|
|
} else {
|
|
|
|
cursor = IncrementalMerkleTree<Depth, Hash>();
|
|
|
|
cursor->append(obj);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
template class IncrementalMerkleTree<INCREMENTAL_MERKLE_TREE_DEPTH, SHA256Compress>;
|
|
|
|
template class IncrementalMerkleTree<INCREMENTAL_MERKLE_TREE_DEPTH_TESTING, SHA256Compress>;
|
|
|
|
|
|
|
|
template class IncrementalWitness<INCREMENTAL_MERKLE_TREE_DEPTH, SHA256Compress>;
|
|
|
|
template class IncrementalWitness<INCREMENTAL_MERKLE_TREE_DEPTH_TESTING, SHA256Compress>;
|
|
|
|
|
|
|
|
template class IncrementalMerkleTree<SAPLING_INCREMENTAL_MERKLE_TREE_DEPTH, PedersenHash>;
|
|
|
|
template class IncrementalMerkleTree<INCREMENTAL_MERKLE_TREE_DEPTH_TESTING, PedersenHash>;
|
|
|
|
|
|
|
|
template class IncrementalWitness<SAPLING_INCREMENTAL_MERKLE_TREE_DEPTH, PedersenHash>;
|
|
|
|
template class IncrementalWitness<INCREMENTAL_MERKLE_TREE_DEPTH_TESTING, PedersenHash>;
|
|
|
|
|
|
|
|
} // end namespace `libzcash`
|