MCPcopy Create free account
hub / github.com/defold/defold / CreateManifestHash

Function CreateManifestHash

engine/resource/src/resource_util.cpp:96–116  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

94}
95
96Result CreateManifestHash(dmLiveUpdateDDF::HashAlgorithm algorithm, const uint8_t* buf, size_t buflen, uint8_t* digest)
97{
98 if (algorithm == dmLiveUpdateDDF::HASH_SHA1)
99 {
100 dmCrypt::HashSha1(buf, buflen, digest);
101 }
102 else if (algorithm == dmLiveUpdateDDF::HASH_SHA256)
103 {
104 dmCrypt::HashSha256(buf, buflen, digest);
105 }
106 else if (algorithm == dmLiveUpdateDDF::HASH_SHA512)
107 {
108 dmCrypt::HashSha512(buf, buflen, digest);
109 }
110 else
111 {
112 dmLogError("The algorithm specified for manifest verification hashing is not supported (%i)", algorithm);
113 return RESULT_INVALID_DATA;
114 }
115 return RESULT_OK;
116}
117
118Result MemCompare(const uint8_t* digest, uint32_t len, const uint8_t* expected_digest, uint32_t expected_len)
119{

Callers

nothing calls this directly

Calls 3

HashSha1Function · 0.85
HashSha256Function · 0.85
HashSha512Function · 0.85

Tested by

no test coverage detected