digest
Message Digest Algorithms
Functions
| Function | Description |
|---|---|
_dig_copy | Internal: byte copy. |
_dig_hex | Internal: hex digit. |
digest_hex | Convert binary hash to hex string. Returns hex length (2 * hlen). |
_md5_s | Internal: MD5 per-round shift amounts. |
_md5_t | Internal: MD5 sine-derived constants (T[i] = floor(2^32 * abs(sin(i+1)))). |
_md5_rotl | Internal: 32-bit left rotate. |
_md5_read32 | Internal: read 32-bit LE from buffer. |
_md5_write32 | Internal: write 32-bit LE to buffer. |
md5 | MD5 hash. out must be 16 bytes. |
md5_hex | MD5 as hex string. Returns 32. |
_sha512_k | SHA-512 round constants (first 16 of 80). |
sha512 | SHA-512 hash. out must be 64 bytes. Note: Simplified implementation — produ… |
sha512_hex | SHA-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) -> i64Internal: hex digit.
digest_hex
fn digest_hex(hash: &i8, hlen: i64, out: &i8) -> i64Convert binary hash to hex string. Returns hex length (2 * hlen).
_md5_s
fn _md5_s(i: i64) -> i64Internal: MD5 per-round shift amounts.
_md5_t
fn _md5_t(i: i64) -> i64Internal: MD5 sine-derived constants (T[i] = floor(2^32 * abs(sin(i+1)))).
_md5_rotl
fn _md5_rotl(x: i64, n: i64) -> i64Internal: 32-bit left rotate.
_md5_read32
fn _md5_read32(buf: &i8, off: i64) -> i64Internal: 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) -> i64MD5 as hex string. Returns 32.
_sha512_k
fn _sha512_k(i: i64) -> i64SHA-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) -> i64SHA-512 as hex string. Returns 128.