module BLAKE256:S
BLAKE256
是 BLAKE2b 雜湊函數,產生 256 位元 (32 位元組) 的摘要。它具有密碼學上的安全性,且摘要的長度足以抵禦暴力破解攻擊。
typet =
string
摘要的類型。
val hash_length : int
摘要的長度,以位元組為單位。
val compare : t -> t -> int
比較兩個摘要,與 compare
具有相同的規範。
val equal : t -> t -> bool
測試兩個摘要是否相等。
val string : string -> t
返回給定字串的摘要。
val bytes : bytes -> t
返回給定位元組序列的摘要。
val substring : string -> int -> int -> t
substring s ofs len
返回字串 s
從索引 ofs
開始,包含 len
個字元的子字串的摘要。
val subbytes : bytes -> int -> int -> t
subbytes s ofs len
返回位元組序列 s
從索引 ofs
開始,包含 len
個位元組的子序列的摘要。
val channel : in_channel -> int -> t
從通道讀取字元並返回它們的摘要。請參閱 Digest.channel
以獲取完整規範。
val file : string -> t
返回給定名稱的檔案的摘要。
val output : out_channel -> t -> unit
將摘要寫入給定的輸出通道。
val input : in_channel -> t
從給定的輸入通道讀取摘要。
val to_hex : t -> string
返回給定摘要的可列印十六進制表示法。
Invalid_argument
如果參數的長度不是 hash_length
。val of_hex : string -> t
將十六進制表示法轉換回對應的摘要。
Invalid_argument
如果參數的長度不是 2 * hash_length
,或者如果參數包含非十六進制字元。