You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

51 lines
1.0 KiB

  1. /*
  2. This file contains the byte & uint64 implementations that are used to test the
  3. bits implementations.
  4. */
  5. package keccak
  6. func thetaU64Version(a [25]uint64) [25]uint64 {
  7. var c0, c1, c2, c3, c4, d uint64
  8. var r [25]uint64
  9. c0 = a[0] ^ a[5] ^ a[10] ^ a[15] ^ a[20]
  10. c1 = a[1] ^ a[6] ^ a[11] ^ a[16] ^ a[21]
  11. c2 = a[2] ^ a[7] ^ a[12] ^ a[17] ^ a[22]
  12. c3 = a[3] ^ a[8] ^ a[13] ^ a[18] ^ a[23]
  13. c4 = a[4] ^ a[9] ^ a[14] ^ a[19] ^ a[24]
  14. d = c4 ^ (c1<<1 | c1>>(64-1))
  15. r[0] = a[0] ^ d
  16. r[5] = a[5] ^ d
  17. r[10] = a[10] ^ d
  18. r[15] = a[15] ^ d
  19. r[20] = a[20] ^ d
  20. d = c0 ^ (c2<<1 | c2>>(64-1))
  21. r[1] = a[1] ^ d
  22. r[6] = a[6] ^ d
  23. r[11] = a[11] ^ d
  24. r[16] = a[16] ^ d
  25. r[21] = a[21] ^ d
  26. d = c1 ^ (c3<<1 | c3>>(64-1))
  27. r[2] = a[2] ^ d
  28. r[7] = a[7] ^ d
  29. r[12] = a[12] ^ d
  30. r[17] = a[17] ^ d
  31. r[22] = a[22] ^ d
  32. d = c2 ^ (c4<<1 | c4>>(64-1))
  33. r[3] = a[3] ^ d
  34. r[8] = a[8] ^ d
  35. r[13] = a[13] ^ d
  36. r[18] = a[18] ^ d
  37. r[23] = a[23] ^ d
  38. d = c3 ^ (c0<<1 | c0>>(64-1))
  39. r[4] = a[4] ^ d
  40. r[9] = a[9] ^ d
  41. r[14] = a[14] ^ d
  42. r[19] = a[19] ^ d
  43. r[24] = a[24] ^ d
  44. return r
  45. }