{"id":"hash-digest-verify","version":"1.0.0","description":"Recompute a fixed-length digest over encoded input bytes and compare it to an expected digest given in any encoding.","supported_operations":["verify sha256 checksum","does this md5 match the file","check if this hash is correct","confirm sha3-256 digest","compare base64 hash to hex hash","validate a downloaded file checksum","אמת גיבוב מול ערך צפוי"],"unsupported_operations":["verifying shake128/shake256/blake3 (no fixed digest length; use hash-digest-compute and compare manually)","fetching the file or URL to hash (text/bytes must be supplied directly)"],"semantics":["algorithm is restricted to the fixed-length digest algorithms (shake128, shake256 and blake3 are invalid_input here; use hash-digest-compute for those).","computed_hex is always the lowercase hex digest of text under algorithm, returned even when valid is false, so the caller can see the correct value.","expected_encoding 'auto' (default) tries, in order, hex (case-insensitive), then base64 (RFC 4648 section 4, padded), then base64url (RFC 4648 section 5, unpadded), each requiring the decoded length to equal the digest length; if none match, the result is valid:false, reason:'expected_not_decodable', matched_encoding:null, with no length/syntax distinction under auto.","An explicit expected_encoding first checks that encoding's own syntax (a failure is 'expected_not_decodable'); a syntactically valid value of the wrong decoded length is 'expected_wrong_length'. Both leave matched_encoding null.","Once expected decodes to exactly the digest length, it is compared to the computed digest with a constant-time comparison: a mismatch is valid:false, reason:\"mismatch\"; a match is valid:true, reason:null, both with matched_encoding set to the encoding that produced the comparison.","hex comparison for expected is case-insensitive; computed_hex in the output is always lowercase regardless of the case used in expected."],"limits":{"max_input_bytes":65536},"pricing":{"status":"unpriced","charge_usd":null},"input_schema":{"type":"object","additionalProperties":false,"required":["text","algorithm","expected"],"properties":{"text":{"type":"string","maxLength":262144},"input_encoding":{"type":"string","enum":["utf8","hex","base64","base64url"],"default":"utf8"},"algorithm":{"type":"string","enum":["md5","sha1","ripemd160","sha224","sha256","sha384","sha512","sha512-224","sha512-256","sha3-224","sha3-256","sha3-384","sha3-512","keccak-256","blake2b-256","blake2b-512","blake2s-256"]},"expected":{"type":"string","minLength":1,"maxLength":512},"expected_encoding":{"type":"string","enum":["auto","hex","base64","base64url"],"default":"auto"}}},"output_schema":{"type":"object","additionalProperties":false,"required":["valid","reason","algorithm","matched_encoding","computed_hex"],"properties":{"valid":{"type":"boolean"},"reason":{"type":["string","null"],"enum":["mismatch","expected_not_decodable","expected_wrong_length",null]},"algorithm":{"type":"string","enum":["md5","sha1","ripemd160","sha224","sha256","sha384","sha512","sha512-224","sha512-256","sha3-224","sha3-256","sha3-384","sha3-512","keccak-256","blake2b-256","blake2b-512","blake2s-256"]},"matched_encoding":{"type":["string","null"],"enum":["hex","base64","base64url",null]},"computed_hex":{"type":"string","pattern":"^[0-9a-f]+$","minLength":2}}},"examples":[{"input":{"text":"abc","algorithm":"sha256","expected":"ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad"},"output":{"valid":true,"reason":null,"algorithm":"sha256","matched_encoding":"hex","computed_hex":"ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad"}},{"input":{"text":"abc","algorithm":"sha256","expected":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"},"output":{"valid":false,"reason":"mismatch","algorithm":"sha256","matched_encoding":"hex","computed_hex":"ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad"}},{"input":{"text":"abc","algorithm":"sha256","expected":"ungWv48Bz+pBQUDeXa4iI7ADYaOWF3qctBD/YfIAFa0="},"output":{"valid":true,"reason":null,"algorithm":"sha256","matched_encoding":"base64","computed_hex":"ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad"}}],"execute_url":"/v1/tools/hash-digest-verify/versions/1.0.0/execute"}