No matching definitions.

tur/digest

stdlib/digest.tur

SHA-256 and MD5 checksum implementations.

Since: Phase B1

defn

digest/sha256

(digest/sha256 [data :int len :int] :int)

compute the SHA-256 digest of a byte buffer.

datapointer (as :int) to the byte data
lennumber of bytes to hash

A heap-allocated vec (:int) of 32 byte values (each 0-255). Free with digest/bytes-free.

(digest/sha256 buf 32)  ; => vec of 32 byte ints

Since: Phase B2

defn

digest/sha256-hex

(digest/sha256-hex [data :int len :int] :cstr)

compute the SHA-256 digest as a lowercase hex string.

datapointer (as :int) to the byte data
lennumber of bytes to hash

A heap-allocated 65-byte NUL-terminated cstr (64 hex chars). The caller must free.

(digest/sha256-hex buf 4)  ; => "9f86d081..."

Since: Phase B2

defn

digest/md5

(digest/md5 [data :int len :int] :int)

compute the MD5 digest of a byte buffer.

datapointer (as :int) to the byte data
lennumber of bytes to hash

A heap-allocated vec (:int) of 16 byte values (each 0-255). Free with digest/bytes-free.

(digest/md5 buf 16)  ; => vec of 16 byte ints

Since: Phase B2

defn

digest/md5-hex

(digest/md5-hex [data :int len :int] :cstr)

compute the MD5 digest as a lowercase hex string.

datapointer (as :int) to the byte data
lennumber of bytes to hash

A heap-allocated 33-byte NUL-terminated cstr (32 hex chars). The caller must free.

(digest/md5-hex buf 4)  ; => "93b885ad..."

Since: Phase B2

defn

digest/bytes-free

(digest/bytes-free [v :int] :void)

free a digest byte vec returned by digest/sha256 or digest/md5.

vvec pointer returned by a digest function
(digest/bytes-free my-digest)

Since: Phase B2