MCPcopy Create free account
hub / github.com/ElementsProject/elements / simplicity_calculateToken

Function simplicity_calculateToken

src/simplicity/elements/ops.c:115–125  ·  view source on GitHub ↗

Compute an Element's issuance Token ID value from an entropy value and an amount prefix. * A reimplementation of CalculateReissuanceToken from Element's 'issuance.cpp'. * * Precondition: NULL != entropy; */

Source from the content-addressed store, hash-verified

113 * Precondition: NULL != entropy;
114 */
115sha256_midstate simplicity_calculateToken(const sha256_midstate* entropy, confPrefix prefix) {
116 uint32_t block[16] = {0};
117 sha256_midstate result;
118
119 memcpy(&block[0], entropy->s, sizeof(entropy->s));
120 block[8] = is_confidential(prefix) ? 0x02000000 : 0x01000000;
121 sha256_iv(result.s);
122 simplicity_sha256_compression(result.s, block);
123
124 return result;
125}
126
127/* Compute an Element's tapleaf hash from a tapleaf version and a 256-bit script value.
128 * A reimplementation of ComputeTapleafHash from Element's 'interpreter.cpp'.

Callers 3

copyInputFunction · 0.85

Calls 2

is_confidentialFunction · 0.85
sha256_ivFunction · 0.85

Tested by

no test coverage detected