plonky2/evm/src/cpu/kernel/asm/hash/blake2b/permutations.asm

75 lines
1.6 KiB
NASM
Raw Normal View History

2022-11-29 16:22:23 -08:00
global permutation_0_constants:
2022-12-12 16:38:40 -08:00
BYTES 0, 1, 2, 3
BYTES 4, 5, 6, 7
BYTES 8, 9, 10, 11
BYTES 12, 13, 14, 15
2022-11-29 16:22:23 -08:00
2022-12-13 10:08:30 -08:00
global permutation_1_constants:
2022-12-12 16:38:40 -08:00
BYTES 14, 10, 4, 8
BYTES 9, 15, 13, 6
BYTES 1, 12, 0, 2
BYTES 11, 7, 5, 3
2022-11-03 16:01:08 -07:00
2022-12-13 10:08:30 -08:00
global permutation_2_constants:
2022-12-12 16:38:40 -08:00
BYTES 11, 8, 12, 0
BYTES 5, 2, 15, 13
2022-12-12 17:29:56 -08:00
BYTES 10, 14, 3, 6
2022-12-12 16:38:40 -08:00
BYTES 7, 1, 9, 4
2022-11-03 16:01:08 -07:00
2022-12-13 10:08:30 -08:00
global permutation_3_constants:
2022-12-12 16:38:40 -08:00
BYTES 7, 9, 3, 1
2022-12-12 17:29:56 -08:00
BYTES 13, 12, 11, 14
2022-12-12 16:38:40 -08:00
BYTES 2, 6, 5, 10
BYTES 4, 0, 15, 8
2022-11-03 16:01:08 -07:00
2022-12-13 10:08:30 -08:00
global permutation_4_constants:
2022-12-12 16:38:40 -08:00
BYTES 9, 0, 5, 7
BYTES 2, 4, 10, 15
BYTES 14, 1, 11, 12
BYTES 6, 8, 3, 13
2022-11-03 16:01:08 -07:00
2022-12-13 10:08:30 -08:00
global permutation_5_constants:
2022-12-12 17:29:56 -08:00
BYTES 2, 12, 6, 10
BYTES 0, 11, 8, 3
BYTES 4, 13, 7, 5
BYTES 15, 14, 1, 9
2022-11-03 16:01:08 -07:00
2022-12-13 10:08:30 -08:00
global permutation_6_constants:
2022-12-12 16:38:40 -08:00
BYTES 12, 5, 1, 15
2022-12-12 17:29:56 -08:00
BYTES 14, 13, 4, 10
2022-12-12 16:38:40 -08:00
BYTES 0, 7, 6, 3
BYTES 9, 2, 8, 11
2022-11-03 16:01:08 -07:00
2022-12-13 10:08:30 -08:00
global permutation_7_constants:
2022-12-12 16:38:40 -08:00
BYTES 13, 11, 7, 14
BYTES 12, 1, 3, 9
BYTES 5, 0, 15, 4
BYTES 8, 6, 2, 10
2022-11-03 16:01:08 -07:00
2022-12-13 10:08:30 -08:00
global permutation_8_constants:
2022-12-12 16:38:40 -08:00
BYTES 6, 15, 14, 9
BYTES 11, 3, 0, 8
BYTES 12, 2, 13, 7
BYTES 1, 4, 10, 5
2022-11-03 16:01:08 -07:00
2022-12-13 10:08:30 -08:00
global permutation_9_constants:
2022-12-12 16:38:40 -08:00
BYTES 10, 2, 8, 4
BYTES 7, 6, 1, 5
BYTES 15, 11, 9, 14
BYTES 3, 12, 13, 0
2022-11-03 16:01:08 -07:00
2022-12-01 21:42:58 -08:00
%macro blake2b_permutation
2022-11-07 14:30:14 -08:00
// stack: round, i
2022-11-29 16:22:23 -08:00
PUSH permutation_0_constants
// stack: permutation_0_constants, round, i
2022-11-07 14:30:14 -08:00
SWAP1
// stack: round, permutation_1_constants, i
2022-11-03 16:01:08 -07:00
%mod_const(10)
2022-11-29 16:22:23 -08:00
// stack: round % 10, permutation_1_constants, i
2022-11-03 16:01:08 -07:00
%mul_const(16)
ADD
2022-11-29 16:22:23 -08:00
// stack: permutation_(round)_constants, i
2022-11-09 13:48:56 -08:00
ADD
2022-11-03 16:01:08 -07:00
%mload_kernel_code
%endmacro