mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Implement ChaCha20 Crypto in stdlib (#2643)
* ChaCha20 implementation, first pass * fix bug with clone_slice when length is 0 * final ChaCha20 crypto tidying * final adjustments; add benchmark * add guards everywhere else or w/e * stdlib 'i++' conformity * release notes & security warning updates * update tests; cleanup; default counter should be 0 not 1 * remove prints in test file * add extra unit tests for unaligned buffers Co-authored-by: Manu Linares <mbarriolinares@gmail.com> * one final alignment test * nice contraction of tests w/ some paranoia sprinkled in * nearly double the efficiency of chacha20's transform Co-authored-by: Manu Linares <mbarriolinares@gmail.com> * fix memory leak in test case * improve one of the unit tests to cover more cases * greatly simplify chacha20 'transform' Co-authored-by: Manu Linares <mbarriolinares@gmail.com> --------- Co-authored-by: Manu Linares <mbarriolinares@gmail.com>
This commit is contained in:
@@ -326,6 +326,8 @@ macro clone(Allocator allocator, value) @nodiscard
|
||||
*>
|
||||
macro clone_slice(Allocator allocator, slice) @nodiscard
|
||||
{
|
||||
if (!lengthof(slice)) return {};
|
||||
|
||||
var $Type = $typeof(slice[0]);
|
||||
|
||||
$Type[] new_arr = new_array(allocator, $Type, slice.len);
|
||||
|
||||
Reference in New Issue
Block a user