keccak/keccak_gen.go

239 lines
2.8 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]
var d uint64
2015-01-01 00:52:34 +00:00
d = c4 ^ (c1<<1 | c1>>63)
2015-01-01 00:52:34 +00:00
a00 = a[0][0] ^ d
2015-01-01 00:52:34 +00:00
a01 = a[1][0] ^ d
2015-01-01 00:40:56 +00:00
a02 = a[2][0] ^ d
2015-01-01 00:40:56 +00:00
a03 = a[3][0] ^ d
2015-01-01 00:40:56 +00:00
a04 = a[4][0] ^ d
2015-01-01 00:40:56 +00:00
d = c0 ^ (c2<<1 | c2>>63)
2015-01-01 00:40:56 +00:00
a10 = a[0][1] ^ d
2015-01-01 00:40:56 +00:00
a11 = a[1][1] ^ d
2015-01-01 00:40:56 +00:00
a12 = a[2][1] ^ d
2015-01-01 00:40:56 +00:00
a13 = a[3][1] ^ d
2015-01-01 00:40:56 +00:00
a14 = a[4][1] ^ d
2015-01-01 00:40:56 +00:00
d = c1 ^ (c3<<1 | c3>>63)
2015-01-01 00:52:34 +00:00
a20 = a[0][2] ^ d
2015-01-01 00:52:34 +00:00
a21 = a[1][2] ^ d
2015-01-01 00:52:34 +00:00
a22 = a[2][2] ^ d
2015-01-01 00:52:34 +00:00
a23 = a[3][2] ^ d
2015-01-01 00:52:34 +00:00
a24 = a[4][2] ^ d
2015-01-01 00:52:34 +00:00
d = c2 ^ (c4<<1 | c4>>63)
2015-01-01 00:52:34 +00:00
a30 = a[0][3] ^ d
2015-01-01 00:52:34 +00:00
a31 = a[1][3] ^ d
2015-01-01 00:52:34 +00:00
a32 = a[2][3] ^ d
2015-01-01 00:52:34 +00:00
a33 = a[3][3] ^ d
2015-01-01 00:52:34 +00:00
a34 = a[4][3] ^ d
2015-01-01 00:40:56 +00:00
d = c3 ^ (c0<<1 | c0>>63)
2015-01-01 00:40:56 +00:00
a40 = a[0][4] ^ d
2015-01-01 00:40:56 +00:00
a41 = a[1][4] ^ d
2015-01-01 00:40:56 +00:00
a42 = a[2][4] ^ d
2015-01-01 00:40:56 +00:00
a43 = a[3][4] ^ d
2015-01-01 00:40:56 +00:00
a44 = a[4][4] ^ d
2015-01-01 00:40:56 +00:00
// Rho
2015-01-01 00:40:56 +00:00
a00 = a00<<0 | a00>>64
2015-01-01 00:40:56 +00:00
a10 = a10<<1 | a10>>63
2015-01-01 00:40:56 +00:00
a20 = a20<<62 | a20>>2
2015-01-01 00:40:56 +00:00
a30 = a30<<28 | a30>>36
2015-01-01 00:40:56 +00:00
a40 = a40<<27 | a40>>37
2015-01-01 00:40:56 +00:00
a01 = a01<<36 | a01>>28
2015-01-01 00:40:56 +00:00
a11 = a11<<44 | a11>>20
2015-01-01 00:40:56 +00:00
a21 = a21<<6 | a21>>58
2015-01-01 00:40:56 +00:00
a31 = a31<<55 | a31>>9
2015-01-01 00:40:56 +00:00
a41 = a41<<20 | a41>>44
2015-01-01 00:40:56 +00:00
a02 = a02<<3 | a02>>61
2015-01-01 00:40:56 +00:00
a12 = a12<<10 | a12>>54
2015-01-01 00:40:56 +00:00
a22 = a22<<43 | a22>>21
2015-01-01 00:40:56 +00:00
a32 = a32<<25 | a32>>39
2015-01-01 00:40:56 +00:00
a42 = a42<<39 | a42>>25
2015-01-01 00:40:56 +00:00
a03 = a03<<41 | a03>>23
2015-01-01 00:40:56 +00:00
a13 = a13<<45 | a13>>19
2015-01-01 00:40:56 +00:00
a23 = a23<<15 | a23>>49
2015-01-01 00:40:56 +00:00
a33 = a33<<21 | a33>>43
2015-01-01 00:40:56 +00:00
a43 = a43<<8 | a43>>56
2015-01-01 00:40:56 +00:00
a04 = a04<<18 | a04>>46
2015-01-01 00:40:56 +00:00
a14 = a14<<2 | a14>>62
2015-01-01 00:40:56 +00:00
a24 = a24<<61 | a24>>3
2015-01-01 00:40:56 +00:00
a34 = a34<<56 | a34>>8
2015-01-01 00:40:56 +00:00
a44 = a44<<14 | a44>>50
2015-01-01 00:40:56 +00:00
// Pi / Chi / output
2015-01-01 00:40:56 +00:00
a[0][0] = a00 ^ (a22 &^ a11)
2015-01-01 00:40:56 +00:00
a[0][1] = a11 ^ (a33 &^ a22)
2015-01-01 00:40:56 +00:00
a[0][2] = a22 ^ (a44 &^ a33)
2015-01-01 00:40:56 +00:00
a[0][3] = a33 ^ (a00 &^ a44)
2015-01-01 00:40:56 +00:00
a[0][4] = a44 ^ (a11 &^ a00)
2015-01-01 00:40:56 +00:00
a[1][0] = a30 ^ (a02 &^ a41)
2015-01-01 00:40:56 +00:00
a[1][1] = a41 ^ (a13 &^ a02)
2015-01-01 00:40:56 +00:00
a[1][2] = a02 ^ (a24 &^ a13)
2015-01-01 00:40:56 +00:00
a[1][3] = a13 ^ (a30 &^ a24)
2015-01-01 00:40:56 +00:00
a[1][4] = a24 ^ (a41 &^ a30)
2015-01-01 00:40:56 +00:00
a[2][0] = a10 ^ (a32 &^ a21)
2015-01-01 00:40:56 +00:00
a[2][1] = a21 ^ (a43 &^ a32)
2015-01-01 00:40:56 +00:00
a[2][2] = a32 ^ (a04 &^ a43)
2015-01-01 00:40:56 +00:00
a[2][3] = a43 ^ (a10 &^ a04)
2015-01-01 00:40:56 +00:00
a[2][4] = a04 ^ (a21 &^ a10)
2015-01-01 00:40:56 +00:00
a[3][0] = a40 ^ (a12 &^ a01)
2015-01-01 00:40:56 +00:00
a[3][1] = a01 ^ (a23 &^ a12)
2015-01-01 00:40:56 +00:00
a[3][2] = a12 ^ (a34 &^ a23)
2015-01-01 00:40:56 +00:00
a[3][3] = a23 ^ (a40 &^ a34)
a[3][4] = a34 ^ (a01 &^ a40)
a[4][0] = a20 ^ (a42 &^ a31)
a[4][1] = a31 ^ (a03 &^ a42)
a[4][2] = a42 ^ (a14 &^ a03)
a[4][3] = a03 ^ (a20 &^ a14)
a[4][4] = a14 ^ (a31 &^ a20)
2015-01-01 00:40:56 +00:00
}