magus v0.3.0 is out. See what's new
¶ View markdown source · ✎ Suggest an edit
2 min read

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 in camelCase: 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


  1. crypto\sha256Hex is also in Buzz's standard library (crypto.hash(HashAlgorithm.Sha256, …)); the magus form is sandbox-aware. ↩︎

  2. crypto\sha512Hex is also in Buzz's standard library (crypto.hash(HashAlgorithm.Sha512, …)); the magus form is sandbox-aware. ↩︎

  3. crypto\sha1Hex is also in Buzz's standard library (crypto.hash(HashAlgorithm.Sha1, …)); the magus form is sandbox-aware. ↩︎

  4. crypto\md5Hex is also in Buzz's standard library (crypto.hash(HashAlgorithm.Md5, …)); the magus form is sandbox-aware. ↩︎

auto-generatedcryptomodulestdlibmagusfile
Last updated (e0463131)
Earlier changes on this page (1)

Full history ↗ · Blame source ↗

Glossary

Magusfile

The magusfile.buzz that declares a project's targets (as export funs) and binds its spells. See targets.

Module

A magus stdlib namespace a magusfile imports for host capabilities: filesystem, exec, vcs, and more. See the module reference.

Buzz

The language magusfiles are written in (the .buzz engine). See engines.

Sandbox

The restricted filesystem and environment a target runs in, so builds stay reproducible and side-effect-free. See sandbox.

Conventions

This page uses none of the site's convention markers. The full set is on the conventions page.