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

Function cmrIV

src/simplicity/dag.c:16–38  ·  view source on GitHub ↗

Given a tag for a node, return the SHA-256 hash of its associated CMR tag. * This is the "initial value" for computing the commitment Merkle root for that expression. * * Precondition: 'tag' \notin {HIDDEN, JET, WORD} */

Source from the content-addressed store, hash-verified

14 * Precondition: 'tag' \notin {HIDDEN, JET, WORD}
15 */
16static sha256_midstate cmrIV(tag_t tag) {
17 switch (tag) {
18 case COMP: return cmr_compIV;
19 case ASSERTL:
20 case ASSERTR:
21 case CASE: return cmr_caseIV;
22 case PAIR: return cmr_pairIV;
23 case DISCONNECT: return cmr_disconnectIV;
24 case INJL: return cmr_injlIV;
25 case INJR: return cmr_injrIV;
26 case TAKE: return cmr_takeIV;
27 case DROP: return cmr_dropIV;
28 case IDEN: return cmr_idenIV;
29 case UNIT: return cmr_unitIV;
30 case WITNESS: return cmr_witnessIV;
31 /* Precondition violated. */
32 case WORD:
33 case HIDDEN:
34 case JET:
35 break;
36 }
37 SIMPLICITY_UNREACHABLE;
38}
39
40/* Given a tag for a node, return the SHA-256 hash of its associated IMR tag.
41 * This is the "initial value" for computing the commitment Merkle root for that expression.

Callers 3

imrIVFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected