-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ChaCha] speed improvement and spec conformance (#44)
* [ChaCha] speed improvement and spec conformance * Improve ref speed by 10x removing the use of (fake) simd * Clearly separate the bernstein/original version from the IETF standard version in term of counters size and nonce handling * Separate XChaCha from the 'normal' ChaCha context * add the ability to seek in the chacha stream * fix example and documentation * [poly1305] make key size apparent at type level also switch initialization to be less mutable * [SALSA] improve performance and tweak APIs * performance bump by ~ 3x not using the fake simd instructions * separate salsa and xsalsa * add some docs * add MIGRATION GUIDE and CHANGELOG for this work
- Loading branch information
Showing
10 changed files
with
591 additions
and
414 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
## Changing slice by array reference | ||
|
||
For slice to array reference changes of the form: | ||
|
||
``` | ||
fn function(value: &[u8]) { ... } | ||
``` | ||
|
||
tto: | ||
|
||
``` | ||
fn function(value: &[u8; 12]) { ... } | ||
``` | ||
|
||
In the case of the caller using array of the right size already, | ||
no changes need to be done. When the caller is using a subslice, | ||
one can use the following construction, from: | ||
|
||
``` | ||
fn caller() { | ||
let slice = &[....]; | ||
function(&slice[0..12]); | ||
} | ||
``` | ||
|
||
to: | ||
|
||
``` | ||
use core::convert::TryFrom; // not-necessary in latest rust edition | ||
fn caller() { | ||
let slice = &[....]; | ||
function(<&[u8; 12]>::try_from(&slice[0..12]).unwrap()); | ||
} | ||
|
||
Note the .unwrap() is just one way to (not) handle the error, and the caller | ||
should integrate the failing `try_from` case with the error handling | ||
conventions of the caller code. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.