std.crypto
sha-1/256/512 (fips 180-4), hmac (rfc 2104); not audited for adversarial use
fnv1a_64
Section titled “fnv1a_64”pub fnv1a_64 :: fn(data: []const u8) -> u64fnv1a_32
Section titled “fnv1a_32”pub fnv1a_32 :: fn(data: []const u8) -> u32pub crc32 :: fn(data: []const u8) -> u32ieee 802.3 polynomial (zip, png)
SHA256_LEN
Section titled “SHA256_LEN”pub SHA256_LEN :: 32usizesha256_into’s out must be at least this long
Digest
Section titled “Digest”pub Digest :: struct { bytes: [32]u8,}Sha256
Section titled “Sha256”pub Sha256 :: struct { h: [8]u32, block: [64]u8, buffered: usize, total: u64,}incremental; also a hash::Hasher; a partial block waits in block
Sha256.update
Section titled “Sha256.update”pub update :: fn(self: *Self, data: []const u8)Sha256.final
Section titled “Sha256.final”pub final :: fn(self: *Self) -> Digestdigest so far; self unchanged
sha256_start
Section titled “sha256_start”pub sha256_start :: fn() -> Sha256sha256_into
Section titled “sha256_into”pub sha256_into :: fn(data: []const u8, out: []u8)out must be >= SHA256_LEN bytes; caller owns it
sha256
Section titled “sha256”pub sha256 :: fn(data: []const u8) -> Digestpub hex :: fn(a: *Arena, bytes: []const u8) -> []const u8lowercase hex, in a
to_hex
Section titled “to_hex”pub to_hex :: fn(a: *Arena, d: Digest) -> []const u864 lowercase hex chars, in a
Sha512Digest
Section titled “Sha512Digest”pub Sha512Digest :: struct { bytes: [64]u8,}Sha512
Section titled “Sha512”pub Sha512 :: struct { h: [8]u64, block: [128]u8, buffered: usize, total: u64,}incremental; also a hash::Hasher
total: bytes; low 67 bits of the 128-bit length
Sha512.update
Section titled “Sha512.update”pub update :: fn(self: *Self, data: []const u8)Sha512.final
Section titled “Sha512.final”pub final :: fn(self: *Self) -> Sha512Digestdigest so far; self unchanged
sha512_start
Section titled “sha512_start”pub sha512_start :: fn() -> Sha512sha512
Section titled “sha512”pub sha512 :: fn(data: []const u8) -> Sha512DigestSha1Digest
Section titled “Sha1Digest”pub Sha1Digest :: struct { bytes: [20]u8,}pub Sha1 :: struct { h: [5]u32, block: [64]u8, buffered: usize, total: u64,}incremental; also a hash::Hasher
Sha1.update
Section titled “Sha1.update”pub update :: fn(self: *Self, data: []const u8)Sha1.final
Section titled “Sha1.final”pub final :: fn(self: *Self) -> Sha1Digestdigest so far; self unchanged
sha1_start
Section titled “sha1_start”pub sha1_start :: fn() -> Sha1pub sha1 :: fn(data: []const u8) -> Sha1Digesthmac_sha256
Section titled “hmac_sha256”pub hmac_sha256 :: fn(key: []const u8, msg: []const u8) -> Digesthmac_sha512
Section titled “hmac_sha512”pub hmac_sha512 :: fn(key: []const u8, msg: []const u8) -> Sha512Digestequal_secure
Section titled “equal_secure”pub equal_secure :: fn(a: []const u8, b: []const u8) -> boolconstant-time compare (length not hidden); compare MACs with this, never ==