Skip to content

Commit

Permalink
added SHA3 tests and blank string tests (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
iddo-bentov authored Oct 9, 2024
1 parent 6356cc7 commit 91b3abd
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 4 deletions.
11 changes: 11 additions & 0 deletions zirgen/circuit/keccak/test0.zir
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// RUN: zirgen -I %S --test %s --test-cycles 3000 --input-data-hex 010000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4700000000000000000 2>&1 | FileCheck %s

import keccak;

test TestKeccak00k { // test_cycles >= 2969
// CHECK-LABEL: Running TestKeccak00k
// CHECK: sha256output: 0x76c3,0x18d2 0x6fa4,0x5017 0x63d1,0xa20e 0xdcf9,0x7a0b 0xcac1,0xa6e1 0x6a0a,0x9b25 0x2310,0x1a7c 0x63a8,0xa832
// CHECK: final accum: [0, 0, 0, 0]
Top ()
}

11 changes: 11 additions & 0 deletions zirgen/circuit/keccak/test0s.zir
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// RUN: zirgen -I %S --test %s --test-cycles 3000 --input-data-hex 010000000000000006000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080a7ffc6f8bf1ed76651c14756a061d662f580ff4de43b49fa82d80a4b80f8434a0000000000000000 2>&1 | FileCheck %s

import keccak;

test TestKeccak00s { // test_cycles >= 2969
// CHECK-LABEL: Running TestKeccak00s
// CHECK: sha256output: 0xdad7,0x2c87 0x2119,0x7471 0xcf4d,0xda92 0x91a1,0x53f6 0x9f4c,0xbe10 0xc80a,0x907e 0x16f3,0x756b 0xc597,0xa0cc
// CHECK: final accum: [0, 0, 0, 0]
Top ()
}

Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import keccak;

test TestKeccak01 { // test_cycles >= 2969
// CHECK-LABEL: Running TestKeccak01
test TestKeccak01k { // test_cycles >= 2969
// CHECK-LABEL: Running TestKeccak01k
// CHECK: sha256output: 0xb395,0x7463 0x8e98,0xa6e 0x7cec,0x17b3 0xfd54,0x4748 0x9b0,0x9293 0xfcda,0x5947 0x573f,0x6678 0x268a,0x23c7
// CHECK: final accum: [0, 0, 0, 0]
Top ()
Expand Down
11 changes: 11 additions & 0 deletions zirgen/circuit/keccak/test1s.zir
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// RUN: zirgen -I %S --test %s --test-cycles 3000 --input-data-hex 010000000000000054686520717569636B2062726F776E20666F78206A756D7073206F76657220746865206C617A7920646F672E0600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080a80f839cd4f83f6c3dafc87feae470045e4eb0d366397d5c6ce34ba1739f734d0000000000000000 2>&1 | FileCheck %s

import keccak;

test TestKeccak01s { // test_cycles >= 2969
// CHECK-LABEL: Running TestKeccak01s
// CHECK: sha256output: 0x56e6,0xb26d 0x9be,0x1343 0xb698,0xebe5 0x4dd,0xb185 0x60dd,0x3168 0x8a01,0x1555 0x3bab,0xfdff 0xf3a2,0xe0db
// CHECK: final accum: [0, 0, 0, 0]
Top ()
}

Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import keccak;

test TestKeccak02 { // test_cycles >= 22772
// CHECK-LABEL: Running TestKeccak02
test TestKeccak02k { // test_cycles >= 22772
// CHECK-LABEL: Running TestKeccak02k
// CHECK: sha256output: 0x420e,0x6b2c 0xc4cd,0x396e 0xcf6b,0x7e4c 0x8b4c,0x1c1e 0x88c3,0x5895 0x34b5,0x81fd 0x1337,0x93a6 0xe530,0x6f1
// CHECK: final accum: [0, 0, 0, 0]
Top ()
Expand Down
11 changes: 11 additions & 0 deletions zirgen/circuit/keccak/test2s.zir
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// RUN: zirgen -I %S --test %s --test-cycles 23000 --input-data-hex 0600000000000000436F6D6D616E64657220526F64657269636B20426C61696E65206C6F6F6B6564206672616E746963616C6C792061726F756E6420746865206272696467652E20776865726520686973206F66666963657273207765726520646972656374696E6720726570616972732077697468206C6F7720616E6420757267656E7420766F696365732C2073757267656F6E7320617373697374696E67206174206120646966666963756C74206F7065726174696F6E2E20546865206772617920737465656C20636F6D706172746D656E7420776173206120636F6E667573696F6E206F6620616374697669746965732C2065616368206F726465726C7920627920697473656C662062757420746865206F766572616C6C20696D7072657373696F6E20776173206F66206368616F732E2053637265656E732061626F7665206F6E652068656C6D736D616E27732073746174696F6E2073686F7765642074686520706C616E65742062656C6F7720616E6420746865206F746865722C20736869707320696E206F72626974206E656172204D61634172746875722C20627574206576657279776865726520656C7365207468652070616E656C20636F7665727320686164206265656E2072656D6F7665642066726F6D20636F6E736F6C65732C207465737420696E737472756D656E7473207765726520636C697070656420696E746F20746865697220696E73696465732C20616E6420746563686E696369616E732073746F6F64206279207769746820636F6C6F722D636F64656420656C656374726F6E696320617373656D626C69657320746F207265706C6163652065766572797468696E672074686174207365656D656420646F75627466756C2E205468756D707320616E64207768696E657320736F756E646564207468726F75676820746865207368697020383920736F6D657768657265206166742074686520656E67696E656572696E67206372657720776F726B6564206F6E207468652068756C6C2E0600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000805db9add409333e7f0834569e8e0f6825d684a88363d398b1d0ead06e01d03c1e0200000000000000546865736520776F7264732077657265207574746572656420696E204A756C79203138303520627920416E6E61205061766C6F766E6120536368657265722C20612064697374696E67756973686564206C616479206F662074686520636F7572742C20616E6420636F6E666964656E7469616C206D6169642D6F662D686F6E6F757220746F2074686520456D7072657373204D617279612046796F646F726F766E612E2049742077617320686572206772656574696E6720746F205072696E63652056617373696C792C2061206D616E206869676820696E2072616E6B20616E64206F66666963652C2077686F207761732074686520666972737420746F20617272697665206174060000000000008076d8ddb3fc6c9825ed4a81157c3486e4f35df5cdcf93df3b5c80f1d93ec144fb0000000000000000 2>&1 | FileCheck %s

import keccak;

test TestKeccak02s { // test_cycles >= 22772
// CHECK-LABEL: Running TestKeccak02s
// CHECK: sha256output: 0x1977,0x59ac 0x2680,0xd214 0xb904,0x6edd 0xaa4b,0xd1b1 0x354d,0xa6d6 0xb97b,0x73ea 0x539d,0x1b80 0xdb0b,0x8f76
// CHECK: final accum: [0, 0, 0, 0]
Top ()
}

0 comments on commit 91b3abd

Please sign in to comment.