struct Digest
pub struct Digest {
}Purpose
Sm3 Cryptographic hash digest state context.
Public fields
This type has no public fields.
#crypto/sm3SM3 digest. Pure Xu, not commercial-crypto certified.
struct Digestpub struct Digest {
}Sm3 Cryptographic hash digest state context.
This type has no public fields.
newpub fn new() DigestConstruct a new value of this type.
No arguments are required.
Digest — a value of this type
emptypub fn empty() Digestempty returns an inert Digest without allocating the 68-word schedule slice.
No arguments are required.
Digest — a value of this type
sum_bytespub fn sum_bytes(s string) stringCompute a raw-byte digest.
s stringstring — result string
sum_prefix_bytespub fn sum_prefix_bytes(s &string, n int) stringHash the first n bytes while reading/compressing a fixed shape determined solely by s.len. n and the bytes may be secret; 0 <= n <= s.len is required. CBC callers must also gather the received MAC without secret-indexed reads. Throws on failure; handle the error or propagate it to the caller.
s &stringn intstring — result string
sumpub fn sum(s string) stringCompute a digest (often lowercase hex).
s stringstring — result string
($&Digest) writepub fn (d $&Digest) write(p &string) intOperation on $&Digest: write data and return the byte count.
d $&DigestDigest instance used by this call (exclusive borrow).p &stringint — bytes written
($&Digest) resetpub fn (d $&Digest) reset()Operation on $&Digest: clear internal state so the value can be reused.
d $&DigestDigest instance used by this call (exclusive borrow).This call does not return a value.
(Digest) sizepub fn (d Digest) size() intOperation on Digest: return the size.
d DigestDigest instance used by this call (value receiver).int — a value of this type
(Digest) blocksizepub fn (d Digest) blocksize() intReturn block size of the cipher or stream in bytes.
d DigestDigest instance used by this call (value receiver).int — a value of this type
(&Digest) sum_bytespub fn (d &Digest) sum_bytes() stringOperation on &Digest: compute a raw-byte digest.
d &DigestDigest instance used by this call (borrow).string — result string
(&Digest) sumpub fn (d &Digest) sum() stringOperation on &Digest: compute a digest (often lowercase hex).
d &DigestDigest instance used by this call (borrow).string — result string