An implementation of the SHA-1 cryptographic hash.
First create a sha1
object using the sha1
constructor, then feed it input using the input
or input_str
methods, which may be called any number of times.
After the entire input has been fed to the hash read the result using the result
or result_str
methods.
The sha1
object may be reused to create multiple hashes by calling the reset
method.
Sha1
- Structure representing the state of a Sha1 computationfor Sha1
of Digest for Sha1
Sha1
pub struct Sha1 {
priv h: [u32, ..DIGEST_BUF_LEN],
priv len_low: u32,
priv len_high: u32,
priv msg_block: [u8, ..MSG_BLOCK_LEN],
priv msg_block_idx: uint,
priv computed: bool,
priv work_buf: [u32, ..WORK_BUF_LEN],
}
Structure representing the state of a Sha1 computation
Sha1
new
fn new() -> Sha1
Construct a sha
object
Digest
for Sha1
reset
fn reset(&mut self)
input
fn input(&mut self, msg: &[u8])
result
fn result(&mut self, out: &mut [u8])
output_bits
fn output_bits(&self) -> uint