digest
Digest algorithms.
Types
| Type | Description |
|---|---|
Blake3 |
State handle for BLAKE3. |
Md5 |
State handle for MD5. |
Sha1 |
State handle for SHA-1. |
Sha256 |
State handle for SHA-256. |
Sha512 |
State handle for SHA-512. |
State |
Supertype for stateful digest handles. |
Functions
blake3 data -> Bin
Computes the BLAKE3 digest.
Parameters
| Name | Type | Description |
|---|---|---|
data |
(Str | Bin) |
Input to hash. |
Returns
The 32-byte digest.
Example
let digest = blake3 "abc"
assert_eq $digest.len 32
assert_eq "${digest:x}"
6437b3ac38465133ffb63b75273a8db548c558465d79db03fd359c6cd5bd9d85
md5 data -> Bin
Computes the MD5 digest.
Parameters
| Name | Type | Description |
|---|---|---|
data |
(Str | Bin) |
Input to hash. |
Returns
The 16-byte digest.
Example
sha1 data -> Bin
Computes the SHA-1 digest.
Parameters
| Name | Type | Description |
|---|---|---|
data |
(Str | Bin) |
Input to hash. |
Returns
The 20-byte digest.
Example
sha256 data -> Bin
Computes the SHA-256 digest.
Parameters
| Name | Type | Description |
|---|---|---|
data |
(Str | Bin) |
Input to hash. |
Returns
The 32-byte digest.
Example
let digest = sha256 "abc"
assert_eq "${digest:x}"
ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad
sha512 data -> Bin
Computes the SHA-512 digest.
Parameters
| Name | Type | Description |
|---|---|---|
data |
(Str | Bin) |
Input to hash. |
Returns
The 64-byte digest.