MCPcopy Create free account
hub / github.com/coreutils/coreutils / b64_equal

Function b64_equal

src/cksum.c:1329–1337  ·  view source on GitHub ↗

Return true if B64_DIGEST is the same as the base64 digest of the DIGEST_LENGTH/8 bytes at BIN_BUFFER. */

Source from the content-addressed store, hash-verified

1327/* Return true if B64_DIGEST is the same as the base64 digest of the
1328 DIGEST_LENGTH/8 bytes at BIN_BUFFER. */
1329static bool
1330b64_equal (unsigned char const *b64_digest, unsigned char const *bin_buffer)
1331{
1332 idx_t b64_n_bytes = BASE64_LENGTH (digest_length >> 3);
1333 char b64[BASE64_LENGTH (DIGEST_BIN_BYTES) + 1];
1334 base64_encode ((char const *) bin_buffer, digest_length >> 3,
1335 b64, sizeof b64);
1336 return memeq (b64_digest, b64, b64_n_bytes + 1);
1337}
1338#endif
1339
1340/* Return true if HEX_DIGEST is the same as the hex-encoded digest of the

Callers 1

digest_checkFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected