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

Function copyRawConfidential

src/simplicity/elements/env.c:31–41  ·  view source on GitHub ↗

Initialize a 'confidential' asset or 'confidential' nonce from an unsigned char array from a 'rawElementsTransaction'. * * Precondition: NULL != conf; * unsigned char rawConf[33] or rawConf == NULL; */

Source from the content-addressed store, hash-verified

29 * unsigned char rawConf[33] or rawConf == NULL;
30 */
31static void copyRawConfidential(confidential* conf, const unsigned char* rawConf) {
32 if (rawConf) {
33 *conf = (confidential){ .prefix = 0x01 == rawConf[0] ? EXPLICIT
34 : 0x01 == (0x01 & rawConf[0]) ? ODD_Y
35 : EVEN_Y
36 };
37 sha256_toMidstate(conf->data.s, &rawConf[1]);
38 } else {
39 *conf = (confidential){0};
40 }
41}
42
43/* Initialize a 'confAmount' from an unsigned char array from a 'rawElementsTransaction'.
44 *

Callers 2

copyInputFunction · 0.85
copyOutputFunction · 0.85

Calls 1

sha256_toMidstateFunction · 0.85

Tested by

no test coverage detected