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

Function simplicity_sha256_confidential

src/simplicity/elements/ops.c:12–20  ·  view source on GitHub ↗

Add an 'confidential' value to be consumed by an ongoing SHA-256 evaluation. * If the 'confidential' value is blinded, then the 'evenPrefix' used if the y coordinate is even, * and the 'oddPrefix' is used if the y coordinate is odd. * If the 'confidential' value is explicit, then '0x01' is used as the prefix. * If the 'confidential' value is "NULL" then only '0x00' added. * * Precondition: N

Source from the content-addressed store, hash-verified

10 * NULL != conf;
11 */
12void simplicity_sha256_confidential(unsigned char evenPrefix, unsigned char oddPrefix, sha256_context* ctx, const confidential* conf) {
13 switch (conf->prefix) {
14 case NONE: sha256_uchar(ctx, 0x00); return;
15 case EXPLICIT: sha256_uchar(ctx, 0x01); break;
16 case EVEN_Y: sha256_uchar(ctx, evenPrefix); break;
17 case ODD_Y: sha256_uchar(ctx, oddPrefix); break;
18 }
19 sha256_hash(ctx, &conf->data);
20}
21
22/* Add an 'confidential' asset to be consumed by an ongoing SHA-256 evaluation.
23 *

Callers 2

Calls 2

sha256_ucharFunction · 0.85
sha256_hashFunction · 0.85

Tested by

no test coverage detected