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

Method Midstate

src/crypto/sha256.cpp:742–758  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

740}
741
742void CSHA256::Midstate(unsigned char hash[OUTPUT_SIZE], uint64_t* len, unsigned char *buffer)
743{
744 WriteBE32(hash, s[0]);
745 WriteBE32(hash + 4, s[1]);
746 WriteBE32(hash + 8, s[2]);
747 WriteBE32(hash + 12, s[3]);
748 WriteBE32(hash + 16, s[4]);
749 WriteBE32(hash + 20, s[5]);
750 WriteBE32(hash + 24, s[6]);
751 WriteBE32(hash + 28, s[7]);
752 if (len) {
753 *len = bytes << 3;
754 }
755 if (buffer) {
756 memcpy(buffer, buf, bytes % 64);
757 }
758}
759
760std::vector<unsigned char> CSHA256::Save() const {
761 size_t buf_size = bytes % 64;

Callers 1

Calls 1

WriteBE32Function · 0.70

Tested by

no test coverage detected