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

Function mkJetCMR

src/simplicity/dag.c:84–93  ·  view source on GitHub ↗

Given the identity hash of a jet specification, return the CMR for a jet that implements that specification. * * Precondition: uint32_t ih[8] */

Source from the content-addressed store, hash-verified

82 * Precondition: uint32_t ih[8]
83 */
84static sha256_midstate mkJetCMR(uint32_t *ih, uint_fast64_t weight) {
85 sha256_midstate result = jetIV;
86 uint32_t block[16] = {0};
87 block[6] = (uint32_t)(weight >> 32);
88 block[7] = (uint32_t)weight;
89 memcpy(&block[8], ih, sizeof(uint32_t[8]));
90 simplicity_sha256_compression(result.s, block);
91
92 return result;
93}
94
95/* Compute the CMR of a jet of scribe(v) : ONE |- TWO^(2^n) that outputs a given bitstring.
96 *

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected