diff options
| author | Peter Williams <peter@newton.cx> | 2013-01-02 00:13:33 -0500 |
|---|---|---|
| committer | Tim Chevalier <chevalier@alum.wellesley.edu> | 2013-01-02 15:33:13 -0800 |
| commit | ae69c2fc7d8996777c41455758343a99efed0f34 (patch) | |
| tree | 7428e9769f117a12e5c4ab7d2243636e61dcdd61 /src/libstd | |
| parent | 392708e3b153eb9f7cd3bf10d1658c76b49632a7 (diff) | |
| download | rust-ae69c2fc7d8996777c41455758343a99efed0f34.tar.gz rust-ae69c2fc7d8996777c41455758343a99efed0f34.zip | |
std: Constify the bytes sent to Sha1::input
We are of course never going to modify the data, and this change allows us to accept data from to_bytes::IterBytes types.
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/sha1.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/libstd/sha1.rs b/src/libstd/sha1.rs index ef3969a376b..70aaf4f3f8c 100644 --- a/src/libstd/sha1.rs +++ b/src/libstd/sha1.rs @@ -37,7 +37,7 @@ use core::vec; /// The SHA-1 interface trait Sha1 { /// Provide message input as bytes - fn input((&[u8])); + fn input((&[const u8])); /// Provide message input as string fn input_str((&str)); /** @@ -75,9 +75,9 @@ pub fn sha1() -> Sha1 { mut computed: bool, work_buf: @~[mut u32]}; - fn add_input(st: &Sha1State, msg: &[u8]) { + fn add_input(st: &Sha1State, msg: &[const u8]) { assert (!st.computed); - for vec::each(msg) |element| { + for vec::each_const(msg) |element| { st.msg_block[st.msg_block_idx] = *element; st.msg_block_idx += 1u; st.len_low += 8u32; @@ -243,7 +243,7 @@ pub fn sha1() -> Sha1 { self.h[4] = 0xC3D2E1F0u32; self.computed = false; } - fn input(msg: &[u8]) { add_input(&self, msg); } + fn input(msg: &[const u8]) { add_input(&self, msg); } fn input_str(msg: &str) { let bs = str::to_bytes(msg); add_input(&self, bs); |
