Skip to content

Commit 80e6a29

Browse files
riptlripatel-fd
authored andcommitted
chacha20: improve correctness test
The previous correctness test technically would not catch issues in the final SIMD to memory matrix transpose. Fixes that by accumulating all output bytes in a block.
1 parent 8e97618 commit 80e6a29

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/ballet/chacha20/test_chacha20rng.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ main( int argc,
3030
/* Test output */
3131

3232
FD_TEST( fd_chacha20rng_ulong( rng )==0x6a19c5d97d2bfd39UL );
33-
for( ulong i=0UL; i<100000UL; i++ )
34-
fd_chacha20rng_ulong( rng );
35-
FD_TEST( fd_chacha20rng_ulong( rng )==0xf4682b7e28eae4a7UL );
33+
ulong x = 0UL;
34+
for( ulong i=0UL; i<100000UL; i++ ) x ^= fd_chacha20rng_ulong( rng );
35+
FD_TEST( x==0xb425be48c89d4f75UL );
3636

3737
do {
3838
FD_LOG_NOTICE(( "Benchmarking fd_chacha20rng_ulong" ));

0 commit comments

Comments
 (0)