Skip to content

digest ​

Checks that the value is a hex digest of one of the given hash algorithms.

Error codes: WRONG_DIGEST, FORMAT_ERROR

Live example · edit rules or inputOpen in playground
rules
input
Invaliderrors
{
  "checksum": "WRONG_DIGEST"
}

The arguments are one or more algorithms. The value is hex digits 0-9a-fA-F of the length of one of them:

AlgorithmLength
md532
sha140
sha25664
sha38496
sha512128
js
{ etag:     { digest: 'md5' } }
{ checksum: { digest: ['sha256', 'sha512'] } }

Only the length and the characters are checked. The case of the input is kept in the output.

The rule is not called hash: in Perl and in the LIVR test suite, a hash is an object.