-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sha1 and Sha2 cleanups & optimizations #8097
Commits on Jul 31, 2013
-
Sha2: Remove unecessary integer type specifications.
Palmer Cox committedJul 31, 2013 Configuration menu - View commit details
-
Copy full SHA for d3a6379 - Browse repository at this point
Copy the full SHA d3a6379View commit details -
Sha2: Rearrage traits / impls / structs.
The code was arranged so that the core Sha2 code came first, and then all of the various implementation of Digest followed along later. The problem is that the Sha512 compression function code is far away from the Sha512 Digest implementation, so, if you are trying to read over the code, you need to scroll all around the file for no good reason. The code was rearranged so that all of the Sha512 code is in one place and all of the Sha256 code is in another and so that all impls for a struct are near the definition of that struct.
Palmer Cox committedJul 31, 2013 Configuration menu - View commit details
-
Copy full SHA for 2e95ccc - Browse repository at this point
Copy the full SHA 2e95cccView commit details -
Sha2: Remove the result_X() methods; move logic into the Digest impls.
The result_X() methods just calculate an output of a fixed size. They don't really have much to do with running the actually hash algorithm until the very last step - the output. It makes much more sense to put all this logic into the Digest impls for each specific variation on the hash function.
Palmer Cox committedJul 31, 2013 Configuration menu - View commit details
-
Copy full SHA for 9cc7573 - Browse repository at this point
Copy the full SHA 9cc7573View commit details -
Sha2: Create cryptoutil.rs and re-write the Sha2 module to make use o…
…f it. There are 2 main pieces of functionality in cryptoutil.rs: * A set of unsafe function for efficiently reading and writing u32 and u64 values. All of these functions are fairly easy to audit to confirm that they do what they are supposed to. * A FixedBuffer struct. This struct keeps track of input data until there is enough of it to execute the a function on it which expects a fixed block of data. The Sha2 module was rewritten to take advantage of the new functions in cryptoutil as well as FixedBuffer. The result is that the duplicate code for maintaining a buffer of input data is removed from the Sha512 and Sha256 implementation. Additionally, the FixedBuffer code is much more efficient than the previous code was.
Palmer Cox committedJul 31, 2013 Configuration menu - View commit details
-
Copy full SHA for e771aef - Browse repository at this point
Copy the full SHA e771aefView commit details -
Sha2: Re-write the Sha2 compression functions to improve performance.
The Sha2 compression functions were re-written to execute the message scheduling calculations in the same loop as the rest of the compression function. The compiler is able to generate much better code. Additionally, innermost part of the compression functions were turned into macros to reduce code duplicate and to make the functions more concise.
Palmer Cox committedJul 31, 2013 Configuration menu - View commit details
-
Copy full SHA for ccfcb04 - Browse repository at this point
Copy the full SHA ccfcb04View commit details -
Crypto: Remove DigestUtil and convert to default methods on the Diges…
…t trait.
Palmer Cox committedJul 31, 2013 Configuration menu - View commit details
-
Copy full SHA for 3714e3a - Browse repository at this point
Copy the full SHA 3714e3aView commit details -
Crypto: Add large input tests for all Digests
Create a helper function in cryptoutil.rs which feeds 1,000,000 'a's into a Digest with varying input sizes and then checks the result. This is essentially the same as one of Sha1's existing tests, so, that test was re-implemented using this method. New tests were added using this method for Sha512 and Sha256.
Palmer Cox committedJul 31, 2013 Configuration menu - View commit details
-
Copy full SHA for 3dabbcb - Browse repository at this point
Copy the full SHA 3dabbcbView commit details -
Crypto: Add overflow checking addition functions.
Added functions to cryptoutil.rs that perform an addition after shifting the 2nd parameter by a specified constant. These function fail!() if integer overflow will result. Updated the Sha2 implementation to use these functions.
Palmer Cox committedJul 31, 2013 Configuration menu - View commit details
-
Copy full SHA for 0b95463 - Browse repository at this point
Copy the full SHA 0b95463View commit details -
Sha1: Update Sha1 to use new functionality in cryptoutil.rs
Palmer Cox committedJul 31, 2013 47Configuration menu - View commit details
-
Copy full SHA for 9ff79f6 - Browse repository at this point
Copy the full SHA 9ff79f6View commit details