diff --git a/src/aessafe.rs b/src/aessafe.rs index 82fda896..25b5893a 100644 --- a/src/aessafe.rs +++ b/src/aessafe.rs @@ -7,7 +7,7 @@ /*! The `aessafe` module implements the AES algorithm completely in software without using any table -lookups or other timing dependant mechanisms. This module actually contains two seperate +lookups or other timing dependant mechanisms. This module actually contains two separate implementations - an implementation that works on a single block at a time and a second implementation that processes 8 blocks in parallel. Some block encryption modes really only work if you are processing a single blocks (CFB, OFB, and CBC encryption for example) while other modes @@ -88,7 +88,7 @@ is first processed to create all of the round keys where each round key is just data that is combined into the AES state by the AddRoundKey step as part of each encryption or decryption round. Processing the round key can be expensive, so this is done before encryption or decryption. Before encrypting or decrypting data, the data to be processed by be Bit Sliced into 8 -seperate variables where each variable holds equivalent bytes from the state. This Bit Sliced state +separate variables where each variable holds equivalent bytes from the state. This Bit Sliced state is stored as a Bs8State, where T is the type that stores each set of bits. The first implementation stores these bits in a u32 which permits up to 8 * 32 = 1024 bits of data to be processed at once. This implementation only processes a single block at a time, so, in reality, only @@ -97,7 +97,7 @@ implementation uses u32x4s - vectors of 4 u32s. Thus, we can process 8 * 128 = 4 which corresponds exactly to 8 blocks. The Bs8State struct implements the AesOps trait, which contains methods for each of the 4 main steps -of the AES algorithm. The types, T, each implement the AesBitValueOps trait, which containts methods +of the AES algorithm. The types, T, each implement the AesBitValueOps trait, which contains methods necessary for processing a collection or bit values and the AesOps trait relies heavily on this trait to perform its operations. diff --git a/src/blockmodes.rs b/src/blockmodes.rs index 8fed8eda..2885b0fd 100644 --- a/src/blockmodes.rs +++ b/src/blockmodes.rs @@ -175,7 +175,7 @@ impl BlockEngine { next_out); } - // Process all remaing blocks. We can pull the history out of the buffers without having to + // Process all remaining blocks. We can pull the history out of the buffers without having to // do any copies let next_in_size = self.in_hist.len() + self.block_size; let next_out_size = self.out_hist.len() + self.block_size; @@ -433,7 +433,7 @@ pub struct PkcsPadding; // where padding is stripped. Since BlockEngine doesn't know if its an Encryption or Decryption // operation, it will call both methods if given a chance. So, this class can't be passed directly // to BlockEngine. Instead, it must be wrapped with EncPadding or DecPadding which will ensure that -// only the propper methods are called. The client of the library, however, doesn't have to +// only the proper methods are called. The client of the library, however, doesn't have to // distinguish encryption padding handling from decryption padding handline, which is the whole // point. impl PaddingProcessor for PkcsPadding { @@ -660,14 +660,14 @@ impl Decryptor for CbcDecryptor { } } -fn add_ctr(ctr: &mut [u8], mut ammount: u8) { +fn add_ctr(ctr: &mut [u8], mut amount: u8) { for i in ctr.iter_mut().rev() { let prev = *i; - *i = i.wrapping_add(ammount); + *i = i.wrapping_add(amount); if *i >= prev { break; } - ammount = 1; + amount = 1; } } diff --git a/src/cryptoutil.rs b/src/cryptoutil.rs index e908ab6b..231e0cdb 100644 --- a/src/cryptoutil.rs +++ b/src/cryptoutil.rs @@ -272,10 +272,10 @@ pub fn add_bytes_to_bits(bits: u64, bytes: u64) -> u64 { let (new_high_bits, new_low_bits) = to_bits(bytes); if new_high_bits > 0 { - panic!("Numeric overflow occured.") + panic!("Numeric overflow occurred.") } - bits.checked_add(new_low_bits).expect("Numeric overflow occured.") + bits.checked_add(new_low_bits).expect("Numeric overflow occurred.") } /// Adds the specified number of bytes to the bit count, which is a tuple where the first element is @@ -297,25 +297,25 @@ pub fn add_bytes_to_bits_tuple } else { match hi.checked_add(new_high_bits) { Some(y) => return (y, x), - None => panic!("Numeric overflow occured.") + None => panic!("Numeric overflow occurred.") } } }, None => { let z = match new_high_bits.checked_add(1) { Some(w) => w, - None => panic!("Numeric overflow occured.") + None => panic!("Numeric overflow occurred.") }; match hi.checked_add(z) { // This re-executes the addition that was already performed earlier when overflow - // occured, this time allowing the overflow to happen. Technically, this could be + // occurred, this time allowing the overflow to happen. Technically, this could be // avoided by using the checked add intrinsic directly, but that involves using // unsafe code and is not really worthwhile considering how infrequently code will // run in practice. This is the reason that this function requires that the type T // be UnsignedInt - overflow is not defined for Signed types. This function could // be implemented for signed types as well if that were needed. Some(y) => return (y, low.wrapping_add(new_low_bits)), - None => panic!("Numeric overflow occured.") + None => panic!("Numeric overflow occurred.") } } } @@ -394,7 +394,7 @@ macro_rules! impl_fixed_buffer( ($name:ident, $size:expr) => ( i += size; } - // Copy any input data into the buffer. At this point in the method, the ammount of + // Copy any input data into the buffer. At this point in the method, the amount of // data left in the input vector will be less than the buffer size and the buffer will // be empty. let input_remaining = input.len() - i; diff --git a/src/ghash.rs b/src/ghash.rs index d9c6a147..cd97c97d 100644 --- a/src/ghash.rs +++ b/src/ghash.rs @@ -4,7 +4,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -/// This is an implementaiton of GHASH as used in GCM [1]. +/// This is an implementation of GHASH as used in GCM [1]. /// It is defined as GHASH(H, A, C), where H is a MAC key, A is authenticated data, /// and C is the ciphertext. GHASH can be used as a keyed MAC, if C is left empty. /// diff --git a/src/pbkdf2.rs b/src/pbkdf2.rs index f21de48f..4dacea27 100644 --- a/src/pbkdf2.rs +++ b/src/pbkdf2.rs @@ -182,7 +182,7 @@ pub fn pbkdf2_check(password: &str, hashed_value: &str) -> Result return Err(ERR_STR) } - // Parse format - currenlty only version 0 is supported + // Parse format - currently only version 0 is supported match iter.next() { Some(fstr) => { match fstr { diff --git a/src/scrypt.rs b/src/scrypt.rs index 44920643..4d6b89fe 100644 --- a/src/scrypt.rs +++ b/src/scrypt.rs @@ -332,7 +332,7 @@ pub fn scrypt_check(password: &str, hashed_value: &str) -> Result return Err(ERR_STR) } - // Parse format - currenlty only version 0 (compact) and 1 (expanded) are supported + // Parse format - currently only version 0 (compact) and 1 (expanded) are supported let params: ScryptParams; match iter.next() { Some(fstr) => { diff --git a/src/step_by.rs b/src/step_by.rs index ac12d4b6..b5b2d2d7 100644 --- a/src/step_by.rs +++ b/src/step_by.rs @@ -4,7 +4,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -/// This module just implements a simple verison of step_by() since +/// This module just implements a simple version of step_by() since /// the function from the standard library is currently unstable. /// This should be removed once that function becomes stable. @@ -14,7 +14,7 @@ use std::ops::{Add, Range}; pub struct StepUp { next: T, end: T, - ammount: T + amount: T } impl Iterator for StepUp where @@ -25,7 +25,7 @@ impl Iterator for StepUp where fn next(&mut self) -> Option { if self.next < self.end { let n = self.next; - self.next = self.next + self.ammount; + self.next = self.next + self.amount; Some(n) } else { None @@ -34,16 +34,16 @@ impl Iterator for StepUp where } pub trait RangeExt { - fn step_up(self, ammount: T) -> StepUp; + fn step_up(self, amount: T) -> StepUp; } impl RangeExt for Range where T: Add + PartialOrd + Copy { - fn step_up(self, ammount: T) -> StepUp { + fn step_up(self, amount: T) -> StepUp { StepUp { next: self.start, end: self.end, - ammount: ammount + amount: amount } } } diff --git a/src/whirlpool.rs b/src/whirlpool.rs index 749f6d72..1b52f2a0 100644 --- a/src/whirlpool.rs +++ b/src/whirlpool.rs @@ -62,7 +62,7 @@ impl Digest for Whirlpool { fn input(&mut self, source: &[u8]) { assert!(!self.finalized); - // (byte length * 8) = (bit lenght) converted in a 72 bit uint + // (byte length * 8) = (bit length) converted in a 72 bit uint let len = source.len() as u64; let len_bits = [ ((len >> (56 + 5)) ) as u8,