keccak/keccak_gen.go

239 lines
2.6 KiB
Go

// Generated from go run gen.go
// DO NOT EDIT
package keccak
// round implements one round of the keccak-f[1600] permutation.
func roundGo(a *[25]uint64) {
var b00, b01, b02, b03, b04 uint64
var b10, b11, b12, b13, b14 uint64
var b20, b21, b22, b23, b24 uint64
var b30, b31, b32, b33, b34 uint64
var b40, b41, b42, b43, b44 uint64
// Theta
var c0, c1, c2, c3, c4 uint64
c0 = a[0]
c1 = a[1]
c2 = a[2]
c3 = a[3]
c4 = a[4]
c0 ^= a[5]
c1 ^= a[6]
c2 ^= a[7]
c3 ^= a[8]
c4 ^= a[9]
c0 ^= a[10]
c1 ^= a[11]
c2 ^= a[12]
c3 ^= a[13]
c4 ^= a[14]
c0 ^= a[15]
c1 ^= a[16]
c2 ^= a[17]
c3 ^= a[18]
c4 ^= a[19]
c0 ^= a[20]
c1 ^= a[21]
c2 ^= a[22]
c3 ^= a[23]
c4 ^= a[24]
var d uint64
d = c4 ^ (c1<<1 | c1>>63)
b00 = a[0] ^ d
b01 = a[5] ^ d
b02 = a[10] ^ d
b03 = a[15] ^ d
b04 = a[20] ^ d
d = c0 ^ (c2<<1 | c2>>63)
b10 = a[1] ^ d
b11 = a[6] ^ d
b12 = a[11] ^ d
b13 = a[16] ^ d
b14 = a[21] ^ d
d = c1 ^ (c3<<1 | c3>>63)
b20 = a[2] ^ d
b21 = a[7] ^ d
b22 = a[12] ^ d
b23 = a[17] ^ d
b24 = a[22] ^ d
d = c2 ^ (c4<<1 | c4>>63)
b30 = a[3] ^ d
b31 = a[8] ^ d
b32 = a[13] ^ d
b33 = a[18] ^ d
b34 = a[23] ^ d
d = c3 ^ (c0<<1 | c0>>63)
b40 = a[4] ^ d
b41 = a[9] ^ d
b42 = a[14] ^ d
b43 = a[19] ^ d
b44 = a[24] ^ d
// Rho
b00 = b00<<0 | b00>>64
b10 = b10<<1 | b10>>63
b20 = b20<<62 | b20>>2
b30 = b30<<28 | b30>>36
b40 = b40<<27 | b40>>37
b01 = b01<<36 | b01>>28
b11 = b11<<44 | b11>>20
b21 = b21<<6 | b21>>58
b31 = b31<<55 | b31>>9
b41 = b41<<20 | b41>>44
b02 = b02<<3 | b02>>61
b12 = b12<<10 | b12>>54
b22 = b22<<43 | b22>>21
b32 = b32<<25 | b32>>39
b42 = b42<<39 | b42>>25
b03 = b03<<41 | b03>>23
b13 = b13<<45 | b13>>19
b23 = b23<<15 | b23>>49
b33 = b33<<21 | b33>>43
b43 = b43<<8 | b43>>56
b04 = b04<<18 | b04>>46
b14 = b14<<2 | b14>>62
b24 = b24<<61 | b24>>3
b34 = b34<<56 | b34>>8
b44 = b44<<14 | b44>>50
// Pi / Chi / output
a[0] = b00 ^ (b22 &^ b11)
a[1] = b11 ^ (b33 &^ b22)
a[2] = b22 ^ (b44 &^ b33)
a[3] = b33 ^ (b00 &^ b44)
a[4] = b44 ^ (b11 &^ b00)
a[5] = b30 ^ (b02 &^ b41)
a[6] = b41 ^ (b13 &^ b02)
a[7] = b02 ^ (b24 &^ b13)
a[8] = b13 ^ (b30 &^ b24)
a[9] = b24 ^ (b41 &^ b30)
a[10] = b10 ^ (b32 &^ b21)
a[11] = b21 ^ (b43 &^ b32)
a[12] = b32 ^ (b04 &^ b43)
a[13] = b43 ^ (b10 &^ b04)
a[14] = b04 ^ (b21 &^ b10)
a[15] = b40 ^ (b12 &^ b01)
a[16] = b01 ^ (b23 &^ b12)
a[17] = b12 ^ (b34 &^ b23)
a[18] = b23 ^ (b40 &^ b34)
a[19] = b34 ^ (b01 &^ b40)
a[20] = b20 ^ (b42 &^ b31)
a[21] = b31 ^ (b03 &^ b42)
a[22] = b42 ^ (b14 &^ b03)
a[23] = b03 ^ (b20 &^ b14)
a[24] = b14 ^ (b31 &^ b20)
}