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
- The SHA-1 interfacesha1
- Construct a sha
objectsha1
The SHA-1 interface
input
fn input(~[u8])
Provide message input as bytes
input_str
fn input_str(str)
Provide message input as string
result
fn result() -> ~[u8]
Read the digest as a vector of 20 bytes. After calling this no further input may be provided until reset is called.
result_str
fn result_str() -> str
Read the digest as a hex string. After calling this no further input may be provided until reset is called.
reset
fn reset()
Reset the SHA-1 state for reuse
sha1
fn sha1() -> sha1
Construct a sha
object