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

Method Save

src/crypto/sha256.cpp:760–778  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

758}
759
760std::vector<unsigned char> CSHA256::Save() const {
761 size_t buf_size = bytes % 64;
762 std::vector<unsigned char> result(40 + buf_size);
763
764 WriteBE32(&result[ 0], s[0]);
765 WriteBE32(&result[ 4], s[1]);
766 WriteBE32(&result[ 8], s[2]);
767 WriteBE32(&result[12], s[3]);
768 WriteBE32(&result[16], s[4]);
769 WriteBE32(&result[20], s[5]);
770 WriteBE32(&result[24], s[6]);
771 WriteBE32(&result[28], s[7]);
772
773 WriteLE64(&result[32], bytes << 3);
774
775 if (buf_size) memcpy(&result[40], buf, buf_size);
776
777 return result;
778}
779
780bool CSHA256::Load(const std::vector<unsigned char>& vch) {
781 if (vch.size() < 40) return false;

Callers 2

EvalScriptFunction · 0.80
SetStartOnSystemStartupFunction · 0.80

Calls 2

WriteLE64Function · 0.85
WriteBE32Function · 0.70

Tested by

no test coverage detected