mirror of
https://github.com/arnaucube/keccak256-circom.git
synced 2026-01-10 16:01:28 +01:00
Update js tests to work with bigint for u64
- Updated js tests to work with bigint for u64 to avoid overflows - Added one more test for Theta with bigger values
This commit is contained in:
@@ -42,6 +42,28 @@ func TestTheta(t *testing.T) {
|
||||
qt.Assert(t, bitsToU64Array(s[:]), qt.DeepEquals, sU64[:])
|
||||
}
|
||||
|
||||
func TestTheta2(t *testing.T) {
|
||||
input := []uint64{26388279066651, 246290629787648, 26388279902208, 25165850, 246290605457408, 7784628352, 844424965783552, 2305843009213694083, 844432714760192, 2305843009249345539, 637534226, 14848, 641204224, 14354, 3670528, 6308236288, 2130304761856, 648518346341354496, 6309216256, 648520476645130240, 4611706359392501763, 792677514882318336, 20340965113972, 4611732197915754499, 792633534417207412}
|
||||
var s [25 * 64]bool
|
||||
var sU64 [25]uint64
|
||||
copy(s[:], u64ArrayToBits(input))
|
||||
copy(sU64[:], input)
|
||||
|
||||
s = theta(s)
|
||||
sU64 = thetaU64Version(sU64)
|
||||
|
||||
// fmt.Println(bitsToU64Array(s[:]))
|
||||
qt.Assert(t, bitsToU64Array(s[:]), qt.DeepEquals, sU64[:])
|
||||
qt.Assert(t, bitsToU64Array(s[:]), qt.DeepEquals,
|
||||
[]uint64{3749081831850030700, 1297317621190464868, 10017560217643747862, 7854780639862409219, 13836147678645575967, 3749090635727681271, 1297915755455157604, 12323429615135705749, 7855062122598582297, 16141814766035214620, 3749090628446369381, 1297071330560683876, 10017586606556924438, 7854780639837253643, 13835971756788491039, 3749090634251287159, 1297070162329376100, 9369068259580659222, 7854780645071013913, 14484490034407743775, 8360757404916954740, 1801500877105239396, 10017570663003408994, 3243123208712177690, 14628605291203076459})
|
||||
fmt.Println(bitsToU64(s[1*64:2*64]), s[1*64:2*64])
|
||||
|
||||
// compute again theta on the current state
|
||||
s = theta(s)
|
||||
sU64 = thetaU64Version(sU64)
|
||||
qt.Assert(t, bitsToU64Array(s[:]), qt.DeepEquals, sU64[:])
|
||||
}
|
||||
|
||||
func TestRhoPi(t *testing.T) {
|
||||
s, sU64 := newS()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user