digest

Message Digest Algorithms

Functions

FunctionDescription
_dig_copyInternal: byte copy.
_dig_hexInternal: hex digit.
digest_hexConvert binary hash to hex string. Returns hex length (2 * hlen).
_md5_sInternal: MD5 per-round shift amounts.
_md5_tInternal: MD5 sine-derived constants (T[i] = floor(2^32 * abs(sin(i+1)))).
_md5_rotlInternal: 32-bit left rotate.
_md5_read32Internal: read 32-bit LE from buffer.
_md5_write32Internal: write 32-bit LE to buffer.
md5MD5 hash. out must be 16 bytes.
md5_hexMD5 as hex string. Returns 32.
_sha512_kSHA-512 round constants (first 16 of 80).
sha512SHA-512 hash. out must be 64 bytes. Note: Simplified implementation — produ…
sha512_hexSHA-512 as hex string. Returns 128.

Details

_dig_copy

fn _dig_copy(dst: &i8, doff: i64, src: &i8, soff: i64, n: i64)

Internal: byte copy.

_dig_hex

fn _dig_hex(v: i64) -> i64

Internal: hex digit.

digest_hex

fn digest_hex(hash: &i8, hlen: i64, out: &i8) -> i64

Convert binary hash to hex string. Returns hex length (2 * hlen).

_md5_s

fn _md5_s(i: i64) -> i64

Internal: MD5 per-round shift amounts.

_md5_t

fn _md5_t(i: i64) -> i64

Internal: MD5 sine-derived constants (T[i] = floor(2^32 * abs(sin(i+1)))).

_md5_rotl

fn _md5_rotl(x: i64, n: i64) -> i64

Internal: 32-bit left rotate.

_md5_read32

fn _md5_read32(buf: &i8, off: i64) -> i64

Internal: read 32-bit LE from buffer.

_md5_write32

fn _md5_write32(buf: &i8, off: i64, val: i64)

Internal: write 32-bit LE to buffer.

md5

fn md5(data: &i8, len: i64, out: &i8)

MD5 hash. out must be 16 bytes.

md5_hex

fn md5_hex(data: &i8, len: i64, out: &i8) -> i64

MD5 as hex string. Returns 32.

_sha512_k

fn _sha512_k(i: i64) -> i64

SHA-512 round constants (first 16 of 80).

sha512

fn sha512(data: &i8, len: i64, out: &i8)

SHA-512 hash. out must be 64 bytes. Note: Simplified implementation — produces a 512-bit digest using the SHA-512 algorithm structure. For production use, prefer the full implementation in crypto.jda’s SHA-256 + this for SHA-512.

sha512_hex

fn sha512_hex(data: &i8, len: i64, out: &i8) -> i64

SHA-512 as hex string. Returns 128.