Bytesrw_md.Sha_1
SHA-1
hash.
module State : sig ... end
Hash state.
value state
is the hash of state
. Warning. This has an effect on state
, it can no longer be State.update
d.
val string : string -> t
string s
is the hash of s
.
val bytes : bytes -> t
bytes b
is the hash of b
.
val slice : Bytesrw.Bytes.Slice.t -> t
slice s
is the hash of the bytes in the range of s
.
val reader : Bytesrw.Bytes.Reader.t -> t
reader r
is the hash of stream r
. This consumes the reader. See also reads
.
val reads :
?state:State.t ->
Bytesrw.Bytes.Reader.t ->
Bytesrw.Bytes.Reader.t * State.t
reads r
is hr, hstate
with:
hr
a reader that taps the reads of r
to update hstate
.hstate
, a hash state of the reads made on hr
so far. This is state
if explicitely given, otherwise defaults to a fresh State.make
.To get the final hash result use value
on hstate
once.
val writes :
?state:State.t ->
Bytesrw.Bytes.Writer.t ->
Bytesrw.Bytes.Writer.t * State.t
writes ?state w
is hw, hstate
with:
hw
a writer that taps the writes to update hstate
before giving them to w
.hstate
, a hash state of the writes made on hw
so far. This is state
if explicitely given, otherwise defaults to a fresh State.make
.To get the final hash result use value
on hstate
once.
val to_binary_string : t -> string
to_binary_string h
is a big-endian binary representation of h
of length length
.
val of_binary_string : string -> (t, string) Stdlib.result
of_binary_string s
is a hash from the big-endian binary representation stored in s
.
val to_hex : t -> string
to_hex h
is the binary representation of h
using lowercase US-ASCII hex digits.
val of_hex : string -> (t, string) Stdlib.result
of_hex s
parses a sequence of hex digits into a hash.
val pp : Stdlib.Format.formatter -> t -> unit
pp
formats hashes for inspection.