crypto
Content digests (SHA-256/512; SHA-1 and MD5 for legacy-checksum interop).
Naming convention: import the module under its bare name (
import "crypto"), reach members with a backslash, and call methods incamelCase:crypto\someMethod.
Methods
sha256Hex
Return the lowercase hex SHA-256 digest of data.
Signature: crypto\sha256Hex(data) → string1 · source
| Parameter | Type | Optional | Description |
|---|---|---|---|
data |
string |
Returns: string
sha256File
Return the lowercase hex SHA-256 digest of the file at path.
Signature: crypto\sha256File(path) → string · source
| Parameter | Type | Optional | Description |
|---|---|---|---|
path |
string |
Returns: string
sha512Hex
Return the lowercase hex SHA-512 digest of data.
Signature: crypto\sha512Hex(data) → string2 · source
| Parameter | Type | Optional | Description |
|---|---|---|---|
data |
string |
Returns: string
sha512File
Return the lowercase hex SHA-512 digest of the file at path.
Signature: crypto\sha512File(path) → string · source
| Parameter | Type | Optional | Description |
|---|---|---|---|
path |
string |
Returns: string
sha1Hex
Return the lowercase hex SHA-1 digest of data. For interop with legacy/git checksums only - SHA-1 is not collision-resistant; use sha256 for anything security-relevant.
Signature: crypto\sha1Hex(data) → string3 · source
| Parameter | Type | Optional | Description |
|---|---|---|---|
data |
string |
Returns: string
sha1File
Return the lowercase hex SHA-1 digest of the file at path. For interop with legacy/git checksums only - SHA-1 is not collision-resistant; use sha256 for anything security-relevant.
Signature: crypto\sha1File(path) → string · source
| Parameter | Type | Optional | Description |
|---|---|---|---|
path |
string |
Returns: string
md5Hex
Return the lowercase hex MD5 digest of data. For interop with legacy checksum manifests only - MD5 is broken; use sha256 for anything security-relevant.
Signature: crypto\md5Hex(data) → string4 · source
| Parameter | Type | Optional | Description |
|---|---|---|---|
data |
string |
Returns: string
md5File
Return the lowercase hex MD5 digest of the file at path. For interop with legacy checksum manifests only - MD5 is broken; use sha256 for anything security-relevant.
Signature: crypto\md5File(path) → string · source
| Parameter | Type | Optional | Description |
|---|---|---|---|
path |
string |
Returns: string
-
crypto\sha256Hexis also in Buzz's standard library (crypto.hash(HashAlgorithm.Sha256, …)); the magus form is sandbox-aware. ↩︎ -
crypto\sha512Hexis also in Buzz's standard library (crypto.hash(HashAlgorithm.Sha512, …)); the magus form is sandbox-aware. ↩︎ -
crypto\sha1Hexis also in Buzz's standard library (crypto.hash(HashAlgorithm.Sha1, …)); the magus form is sandbox-aware. ↩︎ -
crypto\md5Hexis also in Buzz's standard library (crypto.hash(HashAlgorithm.Md5, …)); the magus form is sandbox-aware. ↩︎