params.go 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. // params.go - Parameters and constants
  2. //
  3. // To the extent possible under law, Yawning Angel has waived all copyright
  4. // and related or neighboring rights to the software, using the Creative
  5. // Commons "CC0" public domain dedication. See LICENSE or
  6. // <http://creativecommons.org/publicdomain/zero/1.0/> for full details.
  7. package norx
  8. const (
  9. paramW = 64 // Word size
  10. paramP = 1 // Parallelism degree
  11. paramT = paramW * 4 // Tag size
  12. paramN = paramW * 4 // Nonce size
  13. paramK = paramW * 4 // Key size
  14. paramB = paramW * 16 // Permutation width
  15. paramC = paramW * 4 // Capacity
  16. paramR = paramB - paramC // Rate
  17. // Rotation constants
  18. paramR0 = 8
  19. paramR1 = 19
  20. paramR2 = 40
  21. paramR3 = 63
  22. // Tags
  23. tagHeader = 0x01
  24. tagPayload = 0x02
  25. tagTrailer = 0x04
  26. tagFinal = 0x08
  27. // tagBranch = 0x10
  28. // tagMerge = 0x20
  29. bytesW = paramW / 8
  30. bytesT = paramT / 8
  31. bytesK = paramK / 8
  32. bytesR = paramR / 8
  33. bytesC = paramC / 8
  34. wordsR = paramR / paramW
  35. )
  36. type state struct {
  37. s [16]uint64
  38. rounds int // Round number (NORX_L)
  39. }
  40. // Taken from "Table 3.4: Initialisation constants".
  41. var initializationConstants = [16]uint64{
  42. 0xE4D324772B91DF79,
  43. 0x3AEC9ABAAEB02CCB,
  44. 0x9DFBA13DB4289311,
  45. 0xEF9EB4BF5A97F2C8,
  46. 0x3F466E92C1532034,
  47. 0xE6E986626CC405C1,
  48. 0xACE40F3B549184E1,
  49. 0xD9CFD35762614477,
  50. 0xB15E641748DE5E6B,
  51. 0xAA95E955E10F8410,
  52. 0x28D1034441A9DD40,
  53. 0x7F31BBF964E93BF5,
  54. 0xB5E9E22493DFFB96,
  55. 0xB980C852479FAFBD,
  56. 0xDA24516BF55EAFD4,
  57. 0x86026AE8536F1501,
  58. }