keccak/keccak_gen.go

227 lines
3.3 KiB
Go
Raw Normal View History

2015-01-01 00:40:56 +00:00
// Generated from go run gen.go
// DO NOT EDIT
package keccak
2015-01-01 00:52:34 +00:00
// round implements one round of the keccak-f[1600] permutation.
func roundGo(a *[5][5]uint64) {
2015-01-01 00:40:56 +00:00
2015-01-01 00:52:34 +00:00
var a00, a01, a02, a03, a04 uint64
2015-01-01 00:40:56 +00:00
2015-01-01 00:52:34 +00:00
var a10, a11, a12, a13, a14 uint64
2015-01-01 00:40:56 +00:00
2015-01-01 00:52:34 +00:00
var a20, a21, a22, a23, a24 uint64
2015-01-01 00:40:56 +00:00
2015-01-01 00:52:34 +00:00
var a30, a31, a32, a33, a34 uint64
2015-01-01 00:40:56 +00:00
2015-01-01 00:52:34 +00:00
var a40, a41, a42, a43, a44 uint64
2015-01-01 00:40:56 +00:00
2015-01-01 00:52:34 +00:00
// Theta
var c0, c1, c2, c3, c4 uint64
2015-01-01 00:40:56 +00:00
2015-01-01 00:52:34 +00:00
c0 = a[0][0]
2015-01-01 00:40:56 +00:00
2015-01-01 00:52:34 +00:00
c1 = a[0][1]
2015-01-01 00:40:56 +00:00
2015-01-01 00:52:34 +00:00
c2 = a[0][2]
2015-01-01 00:40:56 +00:00
2015-01-01 00:52:34 +00:00
c3 = a[0][3]
2015-01-01 00:40:56 +00:00
2015-01-01 00:52:34 +00:00
c4 = a[0][4]
2015-01-01 00:40:56 +00:00
2015-01-01 00:52:34 +00:00
c0 ^= a[1][0]
2015-01-01 00:40:56 +00:00
2015-01-01 00:52:34 +00:00
c1 ^= a[1][1]
2015-01-01 00:40:56 +00:00
2015-01-01 00:52:34 +00:00
c2 ^= a[1][2]
2015-01-01 00:40:56 +00:00
2015-01-01 00:52:34 +00:00
c3 ^= a[1][3]
2015-01-01 00:40:56 +00:00
2015-01-01 00:52:34 +00:00
c4 ^= a[1][4]
2015-01-01 00:40:56 +00:00
2015-01-01 00:52:34 +00:00
c0 ^= a[2][0]
2015-01-01 00:40:56 +00:00
2015-01-01 00:52:34 +00:00
c1 ^= a[2][1]
2015-01-01 00:40:56 +00:00
2015-01-01 00:52:34 +00:00
c2 ^= a[2][2]
2015-01-01 00:40:56 +00:00
2015-01-01 00:52:34 +00:00
c3 ^= a[2][3]
2015-01-01 00:40:56 +00:00
2015-01-01 00:52:34 +00:00
c4 ^= a[2][4]
2015-01-01 00:40:56 +00:00
2015-01-01 00:52:34 +00:00
c0 ^= a[3][0]
2015-01-01 00:40:56 +00:00
2015-01-01 00:52:34 +00:00
c1 ^= a[3][1]
2015-01-01 00:40:56 +00:00
2015-01-01 00:52:34 +00:00
c2 ^= a[3][2]
2015-01-01 00:40:56 +00:00
2015-01-01 00:52:34 +00:00
c3 ^= a[3][3]
2015-01-01 00:40:56 +00:00
2015-01-01 00:52:34 +00:00
c4 ^= a[3][4]
c0 ^= a[4][0]
c1 ^= a[4][1]
c2 ^= a[4][2]
c3 ^= a[4][3]
c4 ^= a[4][4]
a00 = a[0][0] ^ c4 ^ (c1<<1 | c1>>63)
a01 = a[1][0] ^ c4 ^ (c1<<1 | c1>>63)
a02 = a[2][0] ^ c4 ^ (c1<<1 | c1>>63)
a03 = a[3][0] ^ c4 ^ (c1<<1 | c1>>63)
2015-01-01 00:40:56 +00:00
2015-01-01 00:52:34 +00:00
a04 = a[4][0] ^ c4 ^ (c1<<1 | c1>>63)
2015-01-01 00:40:56 +00:00
2015-01-01 00:52:34 +00:00
a10 = a[0][1] ^ c0 ^ (c2<<1 | c2>>63)
2015-01-01 00:40:56 +00:00
2015-01-01 00:52:34 +00:00
a11 = a[1][1] ^ c0 ^ (c2<<1 | c2>>63)
2015-01-01 00:40:56 +00:00
2015-01-01 00:52:34 +00:00
a12 = a[2][1] ^ c0 ^ (c2<<1 | c2>>63)
2015-01-01 00:40:56 +00:00
2015-01-01 00:52:34 +00:00
a13 = a[3][1] ^ c0 ^ (c2<<1 | c2>>63)
2015-01-01 00:40:56 +00:00
2015-01-01 00:52:34 +00:00
a14 = a[4][1] ^ c0 ^ (c2<<1 | c2>>63)
2015-01-01 00:40:56 +00:00
2015-01-01 00:52:34 +00:00
a20 = a[0][2] ^ c1 ^ (c3<<1 | c3>>63)
2015-01-01 00:40:56 +00:00
2015-01-01 00:52:34 +00:00
a21 = a[1][2] ^ c1 ^ (c3<<1 | c3>>63)
2015-01-01 00:40:56 +00:00
2015-01-01 00:52:34 +00:00
a22 = a[2][2] ^ c1 ^ (c3<<1 | c3>>63)
2015-01-01 00:40:56 +00:00
2015-01-01 00:52:34 +00:00
a23 = a[3][2] ^ c1 ^ (c3<<1 | c3>>63)
a24 = a[4][2] ^ c1 ^ (c3<<1 | c3>>63)
a30 = a[0][3] ^ c2 ^ (c4<<1 | c4>>63)
a31 = a[1][3] ^ c2 ^ (c4<<1 | c4>>63)
a32 = a[2][3] ^ c2 ^ (c4<<1 | c4>>63)
a33 = a[3][3] ^ c2 ^ (c4<<1 | c4>>63)
a34 = a[4][3] ^ c2 ^ (c4<<1 | c4>>63)
a40 = a[0][4] ^ c3 ^ (c0<<1 | c0>>63)
a41 = a[1][4] ^ c3 ^ (c0<<1 | c0>>63)
a42 = a[2][4] ^ c3 ^ (c0<<1 | c0>>63)
a43 = a[3][4] ^ c3 ^ (c0<<1 | c0>>63)
a44 = a[4][4] ^ c3 ^ (c0<<1 | c0>>63)
2015-01-01 00:40:56 +00:00
// Rho and pi
var b00 = a00<<0 | a00>>64
var b02 = a10<<1 | a10>>63
var b04 = a20<<62 | a20>>2
var b01 = a30<<28 | a30>>36
var b03 = a40<<27 | a40>>37
var b13 = a01<<36 | a01>>28
var b10 = a11<<44 | a11>>20
var b12 = a21<<6 | a21>>58
var b14 = a31<<55 | a31>>9
var b11 = a41<<20 | a41>>44
var b21 = a02<<3 | a02>>61
var b23 = a12<<10 | a12>>54
var b20 = a22<<43 | a22>>21
var b22 = a32<<25 | a32>>39
var b24 = a42<<39 | a42>>25
var b34 = a03<<41 | a03>>23
var b31 = a13<<45 | a13>>19
var b33 = a23<<15 | a23>>49
var b30 = a33<<21 | a33>>43
var b32 = a43<<8 | a43>>56
var b42 = a04<<18 | a04>>46
var b44 = a14<<2 | a14>>62
var b41 = a24<<61 | a24>>3
var b43 = a34<<56 | a34>>8
var b40 = a44<<14 | a44>>50
2015-01-01 00:52:34 +00:00
// Chi / output
2015-01-01 00:40:56 +00:00
2015-01-01 00:52:34 +00:00
a[0][0] = b00 ^ (b20 &^ b10)
2015-01-01 00:40:56 +00:00
2015-01-01 00:52:34 +00:00
a[0][1] = b10 ^ (b30 &^ b20)
2015-01-01 00:40:56 +00:00
2015-01-01 00:52:34 +00:00
a[0][2] = b20 ^ (b40 &^ b30)
2015-01-01 00:40:56 +00:00
2015-01-01 00:52:34 +00:00
a[0][3] = b30 ^ (b00 &^ b40)
2015-01-01 00:40:56 +00:00
2015-01-01 00:52:34 +00:00
a[0][4] = b40 ^ (b10 &^ b00)
2015-01-01 00:40:56 +00:00
2015-01-01 00:52:34 +00:00
a[1][0] = b01 ^ (b21 &^ b11)
2015-01-01 00:40:56 +00:00
2015-01-01 00:52:34 +00:00
a[1][1] = b11 ^ (b31 &^ b21)
2015-01-01 00:40:56 +00:00
2015-01-01 00:52:34 +00:00
a[1][2] = b21 ^ (b41 &^ b31)
2015-01-01 00:40:56 +00:00
2015-01-01 00:52:34 +00:00
a[1][3] = b31 ^ (b01 &^ b41)
2015-01-01 00:40:56 +00:00
2015-01-01 00:52:34 +00:00
a[1][4] = b41 ^ (b11 &^ b01)
2015-01-01 00:40:56 +00:00
2015-01-01 00:52:34 +00:00
a[2][0] = b02 ^ (b22 &^ b12)
2015-01-01 00:40:56 +00:00
2015-01-01 00:52:34 +00:00
a[2][1] = b12 ^ (b32 &^ b22)
2015-01-01 00:40:56 +00:00
2015-01-01 00:52:34 +00:00
a[2][2] = b22 ^ (b42 &^ b32)
2015-01-01 00:40:56 +00:00
2015-01-01 00:52:34 +00:00
a[2][3] = b32 ^ (b02 &^ b42)
2015-01-01 00:40:56 +00:00
2015-01-01 00:52:34 +00:00
a[2][4] = b42 ^ (b12 &^ b02)
2015-01-01 00:40:56 +00:00
2015-01-01 00:52:34 +00:00
a[3][0] = b03 ^ (b23 &^ b13)
2015-01-01 00:40:56 +00:00
2015-01-01 00:52:34 +00:00
a[3][1] = b13 ^ (b33 &^ b23)
2015-01-01 00:40:56 +00:00
2015-01-01 00:52:34 +00:00
a[3][2] = b23 ^ (b43 &^ b33)
2015-01-01 00:40:56 +00:00
2015-01-01 00:52:34 +00:00
a[3][3] = b33 ^ (b03 &^ b43)
2015-01-01 00:40:56 +00:00
2015-01-01 00:52:34 +00:00
a[3][4] = b43 ^ (b13 &^ b03)
2015-01-01 00:40:56 +00:00
2015-01-01 00:52:34 +00:00
a[4][0] = b04 ^ (b24 &^ b14)
2015-01-01 00:40:56 +00:00
2015-01-01 00:52:34 +00:00
a[4][1] = b14 ^ (b34 &^ b24)
2015-01-01 00:40:56 +00:00
2015-01-01 00:52:34 +00:00
a[4][2] = b24 ^ (b44 &^ b34)
2015-01-01 00:40:56 +00:00
2015-01-01 00:52:34 +00:00
a[4][3] = b34 ^ (b04 &^ b44)
2015-01-01 00:40:56 +00:00
2015-01-01 00:52:34 +00:00
a[4][4] = b44 ^ (b14 &^ b04)
2015-01-01 00:40:56 +00:00
}