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

Function sha256_fromMidstate

src/simplicity/sha256.h:83–92  ·  view source on GitHub ↗

Converts a given 'midstate' value to a 'hash' value as 32 bytes stored in an unsigned char array. * * Precondition: unsigned char hash[32]; * uint32_t midstate[8] */

Source from the content-addressed store, hash-verified

81 * uint32_t midstate[8]
82 */
83static inline void sha256_fromMidstate(unsigned char* hash, const uint32_t* midstate) {
84 WriteBE32(hash + 0*4, midstate[0]);
85 WriteBE32(hash + 1*4, midstate[1]);
86 WriteBE32(hash + 2*4, midstate[2]);
87 WriteBE32(hash + 3*4, midstate[3]);
88 WriteBE32(hash + 4*4, midstate[4]);
89 WriteBE32(hash + 5*4, midstate[5]);
90 WriteBE32(hash + 6*4, midstate[6]);
91 WriteBE32(hash + 7*4, midstate[7]);
92}
93
94/* Converts a given 'hash' value as 32 bytes stored in an unsigned char array to a 'midstate' value.
95 *

Calls 1

WriteBE32Function · 0.70

Tested by 2

test_elementsFunction · 0.68