pub trait Digest { fn input(&mut self, input: &[u8]); fn result(&mut self, out: &mut [u8]); fn reset(&mut self); fn output_bits(&self) -> uint; fn input_str(&mut self, input: &str) { ... } fn result_bytes(&mut self) -> ~[u8] { ... } fn result_str(&mut self) -> ~str { ... } }
The Digest trait specifies an interface common to digest functions, such as SHA-1 and the SHA-2 family of digest functions.
fn input(&mut self, input: &[u8])
Provide message data.
fn result(&mut self, out: &mut [u8])
Retrieve the digest result. This method may be called multiple times.
fn reset(&mut self)
Reset the digest. This method must be called after result() and before supplying more data.
fn output_bits(&self) -> uint
Get the output size in bits.
fn input_str(&mut self, input: &str)
Convenience function that feeds a string into a digest.
input
The string to feed into the digestfn result_bytes(&mut self) -> ~[u8]
Convenience function that retrieves the result of a digest as a newly allocated vec of bytes.
fn result_str(&mut self) -> ~str
Convenience function that retrieves the result of a digest as a ~str in hexadecimal format.
Sha224
Sha256
Sha512Trunc224
Sha512Trunc256
Sha384
Sha512
Sha1
Md5
Prefix searches with a type followed by a colon (e.g.
fn:
) to restrict the search to a given type.
Accepted types are: fn
, mod
,
struct
(or str
), enum
,
trait
, typedef
(or
tdef
).