bytes->digest

Computes a named digest over bytes.

Target member

Signature

1bytes->digest(name::string)

Computes a named digest over bytes.

bytes->digest is called with member syntax on a receiver value. bytes->digest works with binary values. Convert strings to bytes before byte-level hashing or encoding, then convert back to a string only for display or transport.

Parameters

name
Required value of type string. Supply name positionally unless the signature shows a keyword form.

Examples

Basic call

1bytes('secret')->digest('SHA256')->encodeBase64->asString
The example keeps binary work on bytes and converts only when text output is needed.

Sign a payload-shaped string

1[2local(payload) = 'method=POST&path=/api/items'3local(signature) = bytes(#payload)->digest('SHA256')->encodeBase64->asString4#signature5]
Digest chains should operate on bytes, then return to string only at the final display or transport step.

Compare a hex digest in logs

1[2local(value) = 'Ada'3bytes(#value)->digest('SHA256')->encodeHex->asString4]
Hex is longer than Base64 but easier to compare by eye in logs.