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; */
| 113 | * Precondition: NULL != entropy; |
| 114 | */ |
| 115 | sha256_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'. |
no test coverage detected