示例#1
0
 public function test_salsa20_20()
 {
     $ary = array(0x61707865, 0x4030201, 0x8070605, 0xc0b0a09, 0x100f0e0d, 0x3320646e, 0x1040103, 0x6020905, 0x7, 0x0, 0x79622d32, 0x14131211, 0x18171615, 0x1c1b1a19, 0x201f1e1d, 0x6b206574);
     salsa20($ary, 20);
     $expected = array(0xb9a205a3, 0x695e150, 0xaa94881a, 0xadb7b12c, 0x798942d4, 0x26107016, 0x64edb1a4, 0x2d27173f, 0xb1c7f1fa, 0x62066edc, 0xe035fa23, 0xc4496f04, 0x2131e6b3, 0x810bde28, 0xf62cb407, 0x6bdede3d);
     $this->assertEquals($expected, $ary);
 }
示例#2
0
function salsa20_8_str($s)
{
    // convert string of 64 bytes to 16 32-bit integers
    $B32 = string2ints($s);
    salsa20($B32, 8);
    return ints2string($B32);
}