digest-kangarootwelve 0.2.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (305) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +51 -11
  3. data/Rakefile +2 -2
  4. data/digest-kangarootwelve.gemspec +322 -42
  5. data/ext/digest/kangarootwelve/ext.c +1 -1
  6. data/ext/digest/kangarootwelve/extconf.rb +13 -1
  7. data/ext/digest/kangarootwelve/keccak/armv6m/KangarooTwelve.link.c +1 -0
  8. data/ext/digest/kangarootwelve/keccak/armv6m/KeccakDuplexWidth1600.link.c +1 -0
  9. data/ext/digest/kangarootwelve/keccak/armv6m/KeccakP-1600-SnP.h +36 -0
  10. data/ext/digest/kangarootwelve/{KeccakP-1600-times2-SnP.h → keccak/armv6m/KeccakP-1600-times2-SnP.h} +10 -10
  11. data/ext/digest/kangarootwelve/{KeccakP-1600-times2-on1.c → keccak/armv6m/KeccakP-1600-times2-on1.c} +13 -7
  12. data/ext/digest/kangarootwelve/{KeccakP-1600-times4-SnP.h → keccak/armv6m/KeccakP-1600-times4-SnP.h} +10 -10
  13. data/ext/digest/kangarootwelve/{KeccakP-1600-times4-on1.c → keccak/armv6m/KeccakP-1600-times4-on1.c} +13 -7
  14. data/ext/digest/kangarootwelve/{KeccakP-1600-times8-SnP.h → keccak/armv6m/KeccakP-1600-times8-SnP.h} +10 -10
  15. data/ext/digest/kangarootwelve/{KeccakP-1600-times8-on1.c → keccak/armv6m/KeccakP-1600-times8-on1.c} +13 -7
  16. data/ext/digest/kangarootwelve/keccak/armv6m/KeccakP-1600-u2-32bi-armv6m-le-gcc.s +1334 -0
  17. data/ext/digest/kangarootwelve/keccak/armv6m/KeccakSpongeWidth1600.link.c +1 -0
  18. data/ext/digest/kangarootwelve/{PlSnP-Fallback.inc → keccak/armv6m/PlSnP-Fallback.inc} +11 -7
  19. data/ext/digest/kangarootwelve/keccak/armv6m/ext.link.c +1 -0
  20. data/ext/digest/kangarootwelve/keccak/armv7a/KangarooTwelve.link.c +1 -0
  21. data/ext/digest/kangarootwelve/keccak/armv7a/KeccakDuplexWidth1600.link.c +1 -0
  22. data/ext/digest/kangarootwelve/keccak/armv7a/KeccakP-1600-SnP.h +37 -0
  23. data/ext/digest/kangarootwelve/keccak/armv7a/KeccakP-1600-armv7a-le-neon-gcc.s +826 -0
  24. data/ext/digest/kangarootwelve/keccak/armv7a/KeccakP-1600-inplace-pl2-armv7a-neon-le-gcc.s +1245 -0
  25. data/ext/digest/kangarootwelve/keccak/armv7a/KeccakP-1600-times2-SnP.h +38 -0
  26. data/ext/digest/kangarootwelve/keccak/armv7a/KeccakP-1600-times4-SnP.h +45 -0
  27. data/ext/digest/kangarootwelve/keccak/armv7a/KeccakP-1600-times4-on2.c +38 -0
  28. data/ext/digest/kangarootwelve/keccak/armv7a/KeccakP-1600-times8-SnP.h +45 -0
  29. data/ext/digest/kangarootwelve/keccak/armv7a/KeccakP-1600-times8-on2.c +38 -0
  30. data/ext/digest/kangarootwelve/keccak/armv7a/KeccakSpongeWidth1600.link.c +1 -0
  31. data/ext/digest/kangarootwelve/keccak/armv7a/PlSnP-Fallback.inc +287 -0
  32. data/ext/digest/kangarootwelve/keccak/armv7a/ext.link.c +1 -0
  33. data/ext/digest/kangarootwelve/keccak/armv7m/KangarooTwelve.link.c +1 -0
  34. data/ext/digest/kangarootwelve/keccak/armv7m/KeccakDuplexWidth1600.link.c +1 -0
  35. data/ext/digest/kangarootwelve/keccak/armv7m/KeccakP-1600-SnP.h +36 -0
  36. data/ext/digest/kangarootwelve/keccak/armv7m/KeccakP-1600-inplace-32bi-armv7m-le-gcc.s +1170 -0
  37. data/ext/digest/kangarootwelve/keccak/armv7m/KeccakP-1600-times2-SnP.h +45 -0
  38. data/ext/digest/kangarootwelve/keccak/armv7m/KeccakP-1600-times2-on1.c +37 -0
  39. data/ext/digest/kangarootwelve/keccak/armv7m/KeccakP-1600-times4-SnP.h +45 -0
  40. data/ext/digest/kangarootwelve/keccak/armv7m/KeccakP-1600-times4-on1.c +37 -0
  41. data/ext/digest/kangarootwelve/keccak/armv7m/KeccakP-1600-times8-SnP.h +45 -0
  42. data/ext/digest/kangarootwelve/keccak/armv7m/KeccakP-1600-times8-on1.c +37 -0
  43. data/ext/digest/kangarootwelve/keccak/armv7m/KeccakSpongeWidth1600.link.c +1 -0
  44. data/ext/digest/kangarootwelve/keccak/armv7m/PlSnP-Fallback.inc +287 -0
  45. data/ext/digest/kangarootwelve/keccak/armv7m/ext.link.c +1 -0
  46. data/ext/digest/kangarootwelve/keccak/armv8a/KangarooTwelve.link.c +1 -0
  47. data/ext/digest/kangarootwelve/keccak/armv8a/KeccakDuplexWidth1600.link.c +1 -0
  48. data/ext/digest/kangarootwelve/keccak/armv8a/KeccakP-1600-SnP.h +28 -0
  49. data/ext/digest/kangarootwelve/keccak/armv8a/KeccakP-1600-armv8a-neon.s +537 -0
  50. data/ext/digest/kangarootwelve/keccak/armv8a/KeccakP-1600-times2-SnP.h +45 -0
  51. data/ext/digest/kangarootwelve/keccak/armv8a/KeccakP-1600-times2-on1.c +37 -0
  52. data/ext/digest/kangarootwelve/keccak/armv8a/KeccakP-1600-times4-SnP.h +45 -0
  53. data/ext/digest/kangarootwelve/keccak/armv8a/KeccakP-1600-times4-on1.c +37 -0
  54. data/ext/digest/kangarootwelve/keccak/armv8a/KeccakP-1600-times8-SnP.h +45 -0
  55. data/ext/digest/kangarootwelve/keccak/armv8a/KeccakP-1600-times8-on1.c +37 -0
  56. data/ext/digest/kangarootwelve/keccak/armv8a/KeccakSpongeWidth1600.link.c +1 -0
  57. data/ext/digest/kangarootwelve/keccak/armv8a/PlSnP-Fallback.inc +287 -0
  58. data/ext/digest/kangarootwelve/keccak/armv8a/ext.link.c +1 -0
  59. data/ext/digest/kangarootwelve/keccak/asmx86-64/KangarooTwelve.link.c +1 -0
  60. data/ext/digest/kangarootwelve/keccak/asmx86-64/KeccakDuplexWidth1600.link.c +1 -0
  61. data/ext/digest/kangarootwelve/keccak/asmx86-64/KeccakP-1600-SnP.h +37 -0
  62. data/ext/digest/kangarootwelve/keccak/asmx86-64/KeccakP-1600-times2-SnP.h +45 -0
  63. data/ext/digest/kangarootwelve/keccak/asmx86-64/KeccakP-1600-times2-on1.c +37 -0
  64. data/ext/digest/kangarootwelve/keccak/asmx86-64/KeccakP-1600-times4-SnP.h +45 -0
  65. data/ext/digest/kangarootwelve/keccak/asmx86-64/KeccakP-1600-times4-on1.c +37 -0
  66. data/ext/digest/kangarootwelve/keccak/asmx86-64/KeccakP-1600-times8-SnP.h +45 -0
  67. data/ext/digest/kangarootwelve/keccak/asmx86-64/KeccakP-1600-times8-on1.c +37 -0
  68. data/ext/digest/kangarootwelve/keccak/asmx86-64/KeccakP-1600-x86-64-gas.s +1190 -0
  69. data/ext/digest/kangarootwelve/keccak/asmx86-64/KeccakSpongeWidth1600.link.c +1 -0
  70. data/ext/digest/kangarootwelve/keccak/asmx86-64/PlSnP-Fallback.inc +287 -0
  71. data/ext/digest/kangarootwelve/keccak/asmx86-64/ext.link.c +1 -0
  72. data/ext/digest/kangarootwelve/keccak/asmx86-64shld/KangarooTwelve.link.c +1 -0
  73. data/ext/digest/kangarootwelve/keccak/asmx86-64shld/KeccakDuplexWidth1600.link.c +1 -0
  74. data/ext/digest/kangarootwelve/keccak/asmx86-64shld/KeccakP-1600-SnP.h +37 -0
  75. data/ext/digest/kangarootwelve/keccak/asmx86-64shld/KeccakP-1600-times2-SnP.h +45 -0
  76. data/ext/digest/kangarootwelve/keccak/asmx86-64shld/KeccakP-1600-times2-on1.c +37 -0
  77. data/ext/digest/kangarootwelve/keccak/asmx86-64shld/KeccakP-1600-times4-SnP.h +45 -0
  78. data/ext/digest/kangarootwelve/keccak/asmx86-64shld/KeccakP-1600-times4-on1.c +37 -0
  79. data/ext/digest/kangarootwelve/keccak/asmx86-64shld/KeccakP-1600-times8-SnP.h +45 -0
  80. data/ext/digest/kangarootwelve/keccak/asmx86-64shld/KeccakP-1600-times8-on1.c +37 -0
  81. data/ext/digest/kangarootwelve/keccak/asmx86-64shld/KeccakP-1600-x86-64-shld-gas.s +1190 -0
  82. data/ext/digest/kangarootwelve/keccak/asmx86-64shld/KeccakSpongeWidth1600.link.c +1 -0
  83. data/ext/digest/kangarootwelve/keccak/asmx86-64shld/PlSnP-Fallback.inc +287 -0
  84. data/ext/digest/kangarootwelve/keccak/asmx86-64shld/ext.link.c +1 -0
  85. data/ext/digest/kangarootwelve/keccak/avr8/KangarooTwelve.link.c +1 -0
  86. data/ext/digest/kangarootwelve/keccak/avr8/KeccakDuplexWidth1600.link.c +1 -0
  87. data/ext/digest/kangarootwelve/keccak/avr8/KeccakP-1600-SnP.h +37 -0
  88. data/ext/digest/kangarootwelve/keccak/avr8/KeccakP-1600-avr8-fast.s +1116 -0
  89. data/ext/digest/kangarootwelve/keccak/avr8/KeccakP-1600-times2-SnP.h +45 -0
  90. data/ext/digest/kangarootwelve/keccak/avr8/KeccakP-1600-times2-on1.c +37 -0
  91. data/ext/digest/kangarootwelve/keccak/avr8/KeccakP-1600-times4-SnP.h +45 -0
  92. data/ext/digest/kangarootwelve/keccak/avr8/KeccakP-1600-times4-on1.c +37 -0
  93. data/ext/digest/kangarootwelve/keccak/avr8/KeccakP-1600-times8-SnP.h +45 -0
  94. data/ext/digest/kangarootwelve/keccak/avr8/KeccakP-1600-times8-on1.c +37 -0
  95. data/ext/digest/kangarootwelve/keccak/avr8/KeccakSpongeWidth1600.link.c +1 -0
  96. data/ext/digest/kangarootwelve/keccak/avr8/PlSnP-Fallback.inc +287 -0
  97. data/ext/digest/kangarootwelve/keccak/avr8/ext.link.c +1 -0
  98. data/ext/digest/kangarootwelve/keccak/bulldozer/KangarooTwelve.link.c +1 -0
  99. data/ext/digest/kangarootwelve/keccak/bulldozer/KeccakDuplexWidth1600.link.c +1 -0
  100. data/ext/digest/kangarootwelve/keccak/bulldozer/KeccakP-1600-SnP.h +39 -0
  101. data/ext/digest/kangarootwelve/keccak/bulldozer/KeccakP-1600-XOP-config.h +6 -0
  102. data/ext/digest/kangarootwelve/keccak/bulldozer/KeccakP-1600-XOP.c +473 -0
  103. data/ext/digest/kangarootwelve/keccak/bulldozer/KeccakP-1600-times2-SIMD128.c +954 -0
  104. data/ext/digest/kangarootwelve/keccak/bulldozer/KeccakP-1600-times2-SnP.h +47 -0
  105. data/ext/digest/kangarootwelve/keccak/bulldozer/KeccakP-1600-times4-SnP.h +45 -0
  106. data/ext/digest/kangarootwelve/keccak/bulldozer/KeccakP-1600-times4-on2.c +38 -0
  107. data/ext/digest/kangarootwelve/keccak/bulldozer/KeccakP-1600-times8-SnP.h +45 -0
  108. data/ext/digest/kangarootwelve/keccak/bulldozer/KeccakP-1600-times8-on2.c +38 -0
  109. data/ext/digest/kangarootwelve/keccak/bulldozer/KeccakP-1600-unrolling.macros +302 -0
  110. data/ext/digest/kangarootwelve/keccak/bulldozer/KeccakSpongeWidth1600.link.c +1 -0
  111. data/ext/digest/kangarootwelve/keccak/bulldozer/PlSnP-Fallback.inc +287 -0
  112. data/ext/digest/kangarootwelve/keccak/bulldozer/SIMD128-config.h +9 -0
  113. data/ext/digest/kangarootwelve/{SnP-Relaned.h → keccak/bulldozer/SnP-Relaned.h} +13 -7
  114. data/ext/digest/kangarootwelve/keccak/bulldozer/ext.link.c +1 -0
  115. data/ext/digest/kangarootwelve/{KangarooTwelve.c → keccak/common/KangarooTwelve.c} +6 -10
  116. data/ext/digest/kangarootwelve/{KangarooTwelve.h → keccak/common/KangarooTwelve.h} +3 -7
  117. data/ext/digest/kangarootwelve/keccak/common/KeccakDuplex-common.h +37 -0
  118. data/ext/digest/kangarootwelve/keccak/common/KeccakDuplex.inc +192 -0
  119. data/ext/digest/kangarootwelve/keccak/common/KeccakDuplexWidth1600.c +34 -0
  120. data/ext/digest/kangarootwelve/keccak/common/KeccakDuplexWidth1600.h +25 -0
  121. data/ext/digest/kangarootwelve/{KeccakSponge-common.h → keccak/common/KeccakSponge-common.h} +5 -7
  122. data/ext/digest/kangarootwelve/{KeccakSponge.inc → keccak/common/KeccakSponge.inc} +6 -8
  123. data/ext/digest/kangarootwelve/{KeccakSpongeWidth1600.c → keccak/common/KeccakSpongeWidth1600.c} +6 -8
  124. data/ext/digest/kangarootwelve/{KeccakSpongeWidth1600.h → keccak/common/KeccakSpongeWidth1600.h} +5 -7
  125. data/ext/digest/kangarootwelve/{Phases.h → keccak/common/Phases.h} +3 -7
  126. data/ext/digest/kangarootwelve/{align.h → keccak/common/align.h} +5 -7
  127. data/ext/digest/kangarootwelve/{brg_endian.h → keccak/common/brg_endian.h} +0 -0
  128. data/ext/digest/kangarootwelve/keccak/compact/KangarooTwelve.link.c +1 -0
  129. data/ext/digest/kangarootwelve/keccak/compact/KeccakDuplexWidth1600.link.c +1 -0
  130. data/ext/digest/kangarootwelve/{KeccakP-1600-SnP.h → keccak/compact/KeccakP-1600-SnP.h} +7 -10
  131. data/ext/digest/kangarootwelve/{KeccakP-1600-compact64.c → keccak/compact/KeccakP-1600-compact64.c} +11 -7
  132. data/ext/digest/kangarootwelve/keccak/compact/KeccakP-1600-times2-SnP.h +45 -0
  133. data/ext/digest/kangarootwelve/keccak/compact/KeccakP-1600-times2-on1.c +37 -0
  134. data/ext/digest/kangarootwelve/keccak/compact/KeccakP-1600-times4-SnP.h +45 -0
  135. data/ext/digest/kangarootwelve/keccak/compact/KeccakP-1600-times4-on1.c +37 -0
  136. data/ext/digest/kangarootwelve/keccak/compact/KeccakP-1600-times8-SnP.h +45 -0
  137. data/ext/digest/kangarootwelve/keccak/compact/KeccakP-1600-times8-on1.c +37 -0
  138. data/ext/digest/kangarootwelve/keccak/compact/KeccakSpongeWidth1600.link.c +1 -0
  139. data/ext/digest/kangarootwelve/keccak/compact/PlSnP-Fallback.inc +287 -0
  140. data/ext/digest/kangarootwelve/keccak/compact/SnP-Relaned.h +140 -0
  141. data/ext/digest/kangarootwelve/keccak/compact/ext.link.c +1 -0
  142. data/ext/digest/kangarootwelve/keccak/generic32/KangarooTwelve.link.c +1 -0
  143. data/ext/digest/kangarootwelve/keccak/generic32/KeccakDuplexWidth1600.link.c +1 -0
  144. data/ext/digest/kangarootwelve/keccak/generic32/KeccakP-1600-SnP.h +38 -0
  145. data/ext/digest/kangarootwelve/keccak/generic32/KeccakP-1600-inplace32BI.c +1162 -0
  146. data/ext/digest/kangarootwelve/keccak/generic32/KeccakP-1600-times2-SnP.h +45 -0
  147. data/ext/digest/kangarootwelve/keccak/generic32/KeccakP-1600-times2-on1.c +37 -0
  148. data/ext/digest/kangarootwelve/keccak/generic32/KeccakP-1600-times4-SnP.h +45 -0
  149. data/ext/digest/kangarootwelve/keccak/generic32/KeccakP-1600-times4-on1.c +37 -0
  150. data/ext/digest/kangarootwelve/keccak/generic32/KeccakP-1600-times8-SnP.h +45 -0
  151. data/ext/digest/kangarootwelve/keccak/generic32/KeccakP-1600-times8-on1.c +37 -0
  152. data/ext/digest/kangarootwelve/keccak/generic32/KeccakSpongeWidth1600.link.c +1 -0
  153. data/ext/digest/kangarootwelve/keccak/generic32/PlSnP-Fallback.inc +287 -0
  154. data/ext/digest/kangarootwelve/keccak/generic32/SnP-Relaned.h +140 -0
  155. data/ext/digest/kangarootwelve/keccak/generic32/ext.link.c +1 -0
  156. data/ext/digest/kangarootwelve/keccak/generic32lc/KangarooTwelve.link.c +1 -0
  157. data/ext/digest/kangarootwelve/keccak/generic32lc/KeccakDuplexWidth1600.link.c +1 -0
  158. data/ext/digest/kangarootwelve/keccak/generic32lc/KeccakP-1600-SnP.h +38 -0
  159. data/ext/digest/kangarootwelve/keccak/generic32lc/KeccakP-1600-inplace32BI.c +1162 -0
  160. data/ext/digest/kangarootwelve/keccak/generic32lc/KeccakP-1600-times2-SnP.h +45 -0
  161. data/ext/digest/kangarootwelve/keccak/generic32lc/KeccakP-1600-times2-on1.c +37 -0
  162. data/ext/digest/kangarootwelve/keccak/generic32lc/KeccakP-1600-times4-SnP.h +45 -0
  163. data/ext/digest/kangarootwelve/keccak/generic32lc/KeccakP-1600-times4-on1.c +37 -0
  164. data/ext/digest/kangarootwelve/keccak/generic32lc/KeccakP-1600-times8-SnP.h +45 -0
  165. data/ext/digest/kangarootwelve/keccak/generic32lc/KeccakP-1600-times8-on1.c +37 -0
  166. data/ext/digest/kangarootwelve/keccak/generic32lc/KeccakSpongeWidth1600.link.c +1 -0
  167. data/ext/digest/kangarootwelve/keccak/generic32lc/PlSnP-Fallback.inc +287 -0
  168. data/ext/digest/kangarootwelve/keccak/generic32lc/SnP-Relaned.h +140 -0
  169. data/ext/digest/kangarootwelve/keccak/generic32lc/ext.link.c +1 -0
  170. data/ext/digest/kangarootwelve/keccak/generic64/KangarooTwelve.link.c +1 -0
  171. data/ext/digest/kangarootwelve/keccak/generic64/KeccakDuplexWidth1600.link.c +1 -0
  172. data/ext/digest/kangarootwelve/keccak/generic64/KeccakP-1600-64.macros +2195 -0
  173. data/ext/digest/kangarootwelve/keccak/generic64/KeccakP-1600-SnP.h +49 -0
  174. data/ext/digest/kangarootwelve/keccak/generic64/KeccakP-1600-opt64-config.h +6 -0
  175. data/ext/digest/kangarootwelve/keccak/generic64/KeccakP-1600-opt64.c +541 -0
  176. data/ext/digest/kangarootwelve/keccak/generic64/KeccakP-1600-times2-SnP.h +45 -0
  177. data/ext/digest/kangarootwelve/keccak/generic64/KeccakP-1600-times2-on1.c +37 -0
  178. data/ext/digest/kangarootwelve/keccak/generic64/KeccakP-1600-times4-SnP.h +45 -0
  179. data/ext/digest/kangarootwelve/keccak/generic64/KeccakP-1600-times4-on1.c +37 -0
  180. data/ext/digest/kangarootwelve/keccak/generic64/KeccakP-1600-times8-SnP.h +45 -0
  181. data/ext/digest/kangarootwelve/keccak/generic64/KeccakP-1600-times8-on1.c +37 -0
  182. data/ext/digest/kangarootwelve/keccak/generic64/KeccakP-1600-unrolling.macros +302 -0
  183. data/ext/digest/kangarootwelve/keccak/generic64/KeccakSpongeWidth1600.link.c +1 -0
  184. data/ext/digest/kangarootwelve/keccak/generic64/PlSnP-Fallback.inc +287 -0
  185. data/ext/digest/kangarootwelve/keccak/generic64/SnP-Relaned.h +140 -0
  186. data/ext/digest/kangarootwelve/keccak/generic64/ext.link.c +1 -0
  187. data/ext/digest/kangarootwelve/keccak/generic64lc/KangarooTwelve.link.c +1 -0
  188. data/ext/digest/kangarootwelve/keccak/generic64lc/KeccakDuplexWidth1600.link.c +1 -0
  189. data/ext/digest/kangarootwelve/keccak/generic64lc/KeccakP-1600-64.macros +2195 -0
  190. data/ext/digest/kangarootwelve/keccak/generic64lc/KeccakP-1600-SnP.h +49 -0
  191. data/ext/digest/kangarootwelve/keccak/generic64lc/KeccakP-1600-opt64-config.h +7 -0
  192. data/ext/digest/kangarootwelve/keccak/generic64lc/KeccakP-1600-opt64.c +541 -0
  193. data/ext/digest/kangarootwelve/keccak/generic64lc/KeccakP-1600-times2-SnP.h +45 -0
  194. data/ext/digest/kangarootwelve/keccak/generic64lc/KeccakP-1600-times2-on1.c +37 -0
  195. data/ext/digest/kangarootwelve/keccak/generic64lc/KeccakP-1600-times4-SnP.h +45 -0
  196. data/ext/digest/kangarootwelve/keccak/generic64lc/KeccakP-1600-times4-on1.c +37 -0
  197. data/ext/digest/kangarootwelve/keccak/generic64lc/KeccakP-1600-times8-SnP.h +45 -0
  198. data/ext/digest/kangarootwelve/keccak/generic64lc/KeccakP-1600-times8-on1.c +37 -0
  199. data/ext/digest/kangarootwelve/keccak/generic64lc/KeccakP-1600-unrolling.macros +302 -0
  200. data/ext/digest/kangarootwelve/keccak/generic64lc/KeccakSpongeWidth1600.link.c +1 -0
  201. data/ext/digest/kangarootwelve/keccak/generic64lc/PlSnP-Fallback.inc +287 -0
  202. data/ext/digest/kangarootwelve/keccak/generic64lc/SnP-Relaned.h +140 -0
  203. data/ext/digest/kangarootwelve/keccak/generic64lc/ext.link.c +1 -0
  204. data/ext/digest/kangarootwelve/keccak/haswell/KangarooTwelve.link.c +1 -0
  205. data/ext/digest/kangarootwelve/keccak/haswell/KeccakDuplexWidth1600.link.c +1 -0
  206. data/ext/digest/kangarootwelve/keccak/haswell/KeccakP-1600-AVX2.s +993 -0
  207. data/ext/digest/kangarootwelve/keccak/haswell/KeccakP-1600-SnP.h +41 -0
  208. data/ext/digest/kangarootwelve/keccak/haswell/KeccakP-1600-times2-SIMD128.c +954 -0
  209. data/ext/digest/kangarootwelve/keccak/haswell/KeccakP-1600-times2-SnP.h +47 -0
  210. data/ext/digest/kangarootwelve/keccak/haswell/KeccakP-1600-times4-SIMD256.c +1303 -0
  211. data/ext/digest/kangarootwelve/keccak/haswell/KeccakP-1600-times4-SnP.h +53 -0
  212. data/ext/digest/kangarootwelve/keccak/haswell/KeccakP-1600-times8-SnP.h +45 -0
  213. data/ext/digest/kangarootwelve/keccak/haswell/KeccakP-1600-times8-on4.c +38 -0
  214. data/ext/digest/kangarootwelve/keccak/haswell/KeccakP-1600-unrolling.macros +302 -0
  215. data/ext/digest/kangarootwelve/keccak/haswell/KeccakSpongeWidth1600.link.c +1 -0
  216. data/ext/digest/kangarootwelve/keccak/haswell/PlSnP-Fallback.inc +287 -0
  217. data/ext/digest/kangarootwelve/keccak/haswell/SIMD128-config.h +8 -0
  218. data/ext/digest/kangarootwelve/keccak/haswell/SIMD256-config.h +7 -0
  219. data/ext/digest/kangarootwelve/keccak/haswell/ext.link.c +1 -0
  220. data/ext/digest/kangarootwelve/keccak/nehalem/KangarooTwelve.link.c +1 -0
  221. data/ext/digest/kangarootwelve/keccak/nehalem/KeccakDuplexWidth1600.link.c +1 -0
  222. data/ext/digest/kangarootwelve/keccak/nehalem/KeccakP-1600-64.macros +2195 -0
  223. data/ext/digest/kangarootwelve/keccak/nehalem/KeccakP-1600-SnP.h +49 -0
  224. data/ext/digest/kangarootwelve/keccak/nehalem/KeccakP-1600-opt64-config.h +7 -0
  225. data/ext/digest/kangarootwelve/keccak/nehalem/KeccakP-1600-opt64.c +541 -0
  226. data/ext/digest/kangarootwelve/keccak/nehalem/KeccakP-1600-times2-SIMD128.c +954 -0
  227. data/ext/digest/kangarootwelve/keccak/nehalem/KeccakP-1600-times2-SnP.h +47 -0
  228. data/ext/digest/kangarootwelve/keccak/nehalem/KeccakP-1600-times4-SnP.h +45 -0
  229. data/ext/digest/kangarootwelve/keccak/nehalem/KeccakP-1600-times4-on2.c +38 -0
  230. data/ext/digest/kangarootwelve/keccak/nehalem/KeccakP-1600-times8-SnP.h +45 -0
  231. data/ext/digest/kangarootwelve/keccak/nehalem/KeccakP-1600-times8-on2.c +38 -0
  232. data/ext/digest/kangarootwelve/keccak/nehalem/KeccakP-1600-unrolling.macros +302 -0
  233. data/ext/digest/kangarootwelve/keccak/nehalem/KeccakSpongeWidth1600.link.c +1 -0
  234. data/ext/digest/kangarootwelve/keccak/nehalem/PlSnP-Fallback.inc +287 -0
  235. data/ext/digest/kangarootwelve/keccak/nehalem/SIMD128-config.h +8 -0
  236. data/ext/digest/kangarootwelve/keccak/nehalem/SnP-Relaned.h +140 -0
  237. data/ext/digest/kangarootwelve/keccak/nehalem/ext.link.c +1 -0
  238. data/ext/digest/kangarootwelve/keccak/reference/KangarooTwelve.link.c +1 -0
  239. data/ext/digest/kangarootwelve/keccak/reference/KeccakDuplexWidth1600.link.c +1 -0
  240. data/ext/digest/kangarootwelve/keccak/reference/KeccakP-1600-SnP.h +41 -0
  241. data/ext/digest/kangarootwelve/keccak/reference/KeccakP-1600-reference.c +424 -0
  242. data/ext/digest/kangarootwelve/keccak/reference/KeccakP-1600-reference.h +20 -0
  243. data/ext/digest/kangarootwelve/keccak/reference/KeccakP-1600-times2-SnP.h +45 -0
  244. data/ext/digest/kangarootwelve/keccak/reference/KeccakP-1600-times2-on1.c +37 -0
  245. data/ext/digest/kangarootwelve/keccak/reference/KeccakP-1600-times4-SnP.h +45 -0
  246. data/ext/digest/kangarootwelve/keccak/reference/KeccakP-1600-times4-on1.c +37 -0
  247. data/ext/digest/kangarootwelve/keccak/reference/KeccakP-1600-times8-SnP.h +45 -0
  248. data/ext/digest/kangarootwelve/keccak/reference/KeccakP-1600-times8-on1.c +37 -0
  249. data/ext/digest/kangarootwelve/keccak/reference/KeccakSpongeWidth1600.link.c +1 -0
  250. data/ext/digest/kangarootwelve/keccak/reference/PlSnP-Fallback.inc +287 -0
  251. data/ext/digest/kangarootwelve/keccak/reference/displayIntermediateValues.c +176 -0
  252. data/ext/digest/kangarootwelve/keccak/reference/displayIntermediateValues.h +29 -0
  253. data/ext/digest/kangarootwelve/keccak/reference/ext.link.c +1 -0
  254. data/ext/digest/kangarootwelve/keccak/reference32bits/KangarooTwelve.link.c +1 -0
  255. data/ext/digest/kangarootwelve/keccak/reference32bits/KeccakDuplexWidth1600.link.c +1 -0
  256. data/ext/digest/kangarootwelve/keccak/reference32bits/KeccakP-1600-SnP.h +41 -0
  257. data/ext/digest/kangarootwelve/keccak/reference32bits/KeccakP-1600-reference.h +20 -0
  258. data/ext/digest/kangarootwelve/keccak/reference32bits/KeccakP-1600-reference32BI.c +612 -0
  259. data/ext/digest/kangarootwelve/keccak/reference32bits/KeccakP-1600-times2-SnP.h +45 -0
  260. data/ext/digest/kangarootwelve/keccak/reference32bits/KeccakP-1600-times2-on1.c +37 -0
  261. data/ext/digest/kangarootwelve/keccak/reference32bits/KeccakP-1600-times4-SnP.h +45 -0
  262. data/ext/digest/kangarootwelve/keccak/reference32bits/KeccakP-1600-times4-on1.c +37 -0
  263. data/ext/digest/kangarootwelve/keccak/reference32bits/KeccakP-1600-times8-SnP.h +45 -0
  264. data/ext/digest/kangarootwelve/keccak/reference32bits/KeccakP-1600-times8-on1.c +37 -0
  265. data/ext/digest/kangarootwelve/keccak/reference32bits/KeccakSpongeWidth1600.link.c +1 -0
  266. data/ext/digest/kangarootwelve/keccak/reference32bits/PlSnP-Fallback.inc +287 -0
  267. data/ext/digest/kangarootwelve/keccak/reference32bits/displayIntermediateValues.c +176 -0
  268. data/ext/digest/kangarootwelve/keccak/reference32bits/displayIntermediateValues.h +29 -0
  269. data/ext/digest/kangarootwelve/keccak/reference32bits/ext.link.c +1 -0
  270. data/ext/digest/kangarootwelve/keccak/sandybridge/KangarooTwelve.link.c +1 -0
  271. data/ext/digest/kangarootwelve/keccak/sandybridge/KeccakDuplexWidth1600.link.c +1 -0
  272. data/ext/digest/kangarootwelve/keccak/sandybridge/KeccakP-1600-64.macros +2195 -0
  273. data/ext/digest/kangarootwelve/keccak/sandybridge/KeccakP-1600-SnP.h +49 -0
  274. data/ext/digest/kangarootwelve/keccak/sandybridge/KeccakP-1600-opt64-config.h +8 -0
  275. data/ext/digest/kangarootwelve/keccak/sandybridge/KeccakP-1600-opt64.c +541 -0
  276. data/ext/digest/kangarootwelve/keccak/sandybridge/KeccakP-1600-times2-SIMD128.c +954 -0
  277. data/ext/digest/kangarootwelve/keccak/sandybridge/KeccakP-1600-times2-SnP.h +47 -0
  278. data/ext/digest/kangarootwelve/keccak/sandybridge/KeccakP-1600-times4-SnP.h +45 -0
  279. data/ext/digest/kangarootwelve/keccak/sandybridge/KeccakP-1600-times4-on2.c +38 -0
  280. data/ext/digest/kangarootwelve/keccak/sandybridge/KeccakP-1600-times8-SnP.h +45 -0
  281. data/ext/digest/kangarootwelve/keccak/sandybridge/KeccakP-1600-times8-on2.c +38 -0
  282. data/ext/digest/kangarootwelve/keccak/sandybridge/KeccakP-1600-unrolling.macros +302 -0
  283. data/ext/digest/kangarootwelve/keccak/sandybridge/KeccakSpongeWidth1600.link.c +1 -0
  284. data/ext/digest/kangarootwelve/keccak/sandybridge/PlSnP-Fallback.inc +287 -0
  285. data/ext/digest/kangarootwelve/keccak/sandybridge/SIMD128-config.h +8 -0
  286. data/ext/digest/kangarootwelve/keccak/sandybridge/SnP-Relaned.h +140 -0
  287. data/ext/digest/kangarootwelve/keccak/sandybridge/ext.link.c +1 -0
  288. data/ext/digest/kangarootwelve/keccak/skylakex/KangarooTwelve.link.c +1 -0
  289. data/ext/digest/kangarootwelve/keccak/skylakex/KeccakDuplexWidth1600.link.c +1 -0
  290. data/ext/digest/kangarootwelve/keccak/skylakex/KeccakP-1600-AVX512-config.h +6 -0
  291. data/ext/digest/kangarootwelve/keccak/skylakex/KeccakP-1600-AVX512.c +621 -0
  292. data/ext/digest/kangarootwelve/keccak/skylakex/KeccakP-1600-SnP.h +42 -0
  293. data/ext/digest/kangarootwelve/keccak/skylakex/KeccakP-1600-times2-SIMD512.c +852 -0
  294. data/ext/digest/kangarootwelve/keccak/skylakex/KeccakP-1600-times2-SnP.h +49 -0
  295. data/ext/digest/kangarootwelve/keccak/skylakex/KeccakP-1600-times4-SIMD512.c +883 -0
  296. data/ext/digest/kangarootwelve/keccak/skylakex/KeccakP-1600-times4-SnP.h +49 -0
  297. data/ext/digest/kangarootwelve/keccak/skylakex/KeccakP-1600-times8-SIMD512.c +1473 -0
  298. data/ext/digest/kangarootwelve/keccak/skylakex/KeccakP-1600-times8-SnP.h +53 -0
  299. data/ext/digest/kangarootwelve/keccak/skylakex/KeccakSpongeWidth1600.link.c +1 -0
  300. data/ext/digest/kangarootwelve/keccak/skylakex/SIMD512-2-config.h +7 -0
  301. data/ext/digest/kangarootwelve/keccak/skylakex/SIMD512-4-config.h +7 -0
  302. data/ext/digest/kangarootwelve/keccak/skylakex/SIMD512-config.h +7 -0
  303. data/ext/digest/kangarootwelve/keccak/skylakex/ext.link.c +1 -0
  304. data/lib/digest/kangarootwelve/version.rb +1 -1
  305. metadata +299 -21
@@ -0,0 +1 @@
1
+ #include "../../ext.c"
@@ -0,0 +1 @@
1
+ #include "../common/KangarooTwelve.c"
@@ -0,0 +1 @@
1
+ #include "../common/KeccakDuplexWidth1600.c"
@@ -0,0 +1,39 @@
1
+ /*
2
+ Implementation by Gilles Van Assche, hereby denoted as "the implementer".
3
+
4
+ For more information, feedback or questions, please refer to our website:
5
+ https://keccak.team/
6
+
7
+ To the extent possible under law, the implementer has waived all copyright
8
+ and related or neighboring rights to the source code in this file.
9
+ http://creativecommons.org/publicdomain/zero/1.0/
10
+
11
+ ---
12
+
13
+ Please refer to SnP-documentation.h for more details.
14
+ */
15
+
16
+ #ifndef _KeccakP_1600_SnP_h_
17
+ #define _KeccakP_1600_SnP_h_
18
+
19
+ #include "KeccakP-1600-XOP-config.h"
20
+
21
+ #define KeccakP1600_implementation "implementation optimized for XOP (" KeccakP1600_implementation_config ")"
22
+ #define KeccakP1600_stateSizeInBytes 200
23
+ #define KeccakP1600_stateAlignment 8
24
+
25
+ #include <stddef.h>
26
+
27
+ #define KeccakP1600_StaticInitialize()
28
+ void KeccakP1600_Initialize(void *state);
29
+ void KeccakP1600_AddByte(void *state, unsigned char data, unsigned int offset);
30
+ void KeccakP1600_AddBytes(void *state, const unsigned char *data, unsigned int offset, unsigned int length);
31
+ void KeccakP1600_OverwriteBytes(void *state, const unsigned char *data, unsigned int offset, unsigned int length);
32
+ void KeccakP1600_OverwriteWithZeroes(void *state, unsigned int byteCount);
33
+ void KeccakP1600_Permute_Nrounds(void *state, unsigned int nrounds);
34
+ void KeccakP1600_Permute_12rounds(void *state);
35
+ void KeccakP1600_Permute_24rounds(void *state);
36
+ void KeccakP1600_ExtractBytes(const void *state, unsigned char *data, unsigned int offset, unsigned int length);
37
+ void KeccakP1600_ExtractAndAddBytes(const void *state, const unsigned char *input, unsigned char *output, unsigned int offset, unsigned int length);
38
+
39
+ #endif
@@ -0,0 +1,6 @@
1
+ /*
2
+ This file defines some parameters of the implementation in the parent directory.
3
+ */
4
+
5
+ #define KeccakP1600_implementation_config "all rounds unrolled"
6
+ #define KeccakP1600_fullUnrolling
@@ -0,0 +1,473 @@
1
+ /*
2
+ Implementation by Gilles Van Assche, hereby denoted as "the implementer".
3
+
4
+ For more information, feedback or questions, please refer to our website:
5
+ https://keccak.team/
6
+
7
+ To the extent possible under law, the implementer has waived all copyright
8
+ and related or neighboring rights to the source code in this file.
9
+ http://creativecommons.org/publicdomain/zero/1.0/
10
+
11
+ ---
12
+
13
+ This file implements Keccak-p[1600] in a SnP-compatible way.
14
+ Please refer to SnP-documentation.h for more details.
15
+
16
+ This implementation comes with KeccakP-1600-SnP.h in the same folder.
17
+ Please refer to LowLevel.build for the exact list of other files it must be combined with.
18
+ */
19
+
20
+ #include <string.h>
21
+ #include <stdlib.h>
22
+ #include "KeccakP-1600-XOP-config.h"
23
+
24
+ typedef unsigned char UINT8;
25
+ typedef unsigned long long int UINT64;
26
+
27
+ #include "align.h"
28
+ #ifdef KeccakP1600_fullUnrolling
29
+ #define FullUnrolling
30
+ #else
31
+ #define Unrolling KeccakP1600_unrolling
32
+ #endif
33
+ #include "KeccakP-1600-unrolling.macros"
34
+ #include "SnP-Relaned.h"
35
+
36
+ #include <x86intrin.h>
37
+ typedef __m128i V64;
38
+ typedef __m128i V128;
39
+
40
+ #define LOAD64(a) _mm_loadl_epi64((const V64 *)&(a))
41
+ #define CONST64(a) _mm_loadl_epi64((const V64 *)&(a))
42
+ #define STORE64(a, b) _mm_storel_epi64((V64 *)&(a), b)
43
+ #define XOR64(a, b) _mm_xor_si128(a, b)
44
+ #define XOReq64(a, b) a = _mm_xor_si128(a, b)
45
+
46
+ #define ANDnu128(a, b) _mm_andnot_si128(a, b)
47
+ #define LOAD6464(a, b) _mm_set_epi64((__m64)(a), (__m64)(b))
48
+ #define CONST128(a) _mm_load_si128((const V128 *)&(a))
49
+ #define LOAD128(a) _mm_load_si128((const V128 *)&(a))
50
+ #define LOAD128u(a) _mm_loadu_si128((const V128 *)&(a))
51
+ #define STORE128(a, b) _mm_store_si128((V128 *)&(a), b)
52
+ #define XOR128(a, b) _mm_xor_si128(a, b)
53
+ #define XOReq128(a, b) a = _mm_xor_si128(a, b)
54
+ #define ZERO128() _mm_setzero_si128()
55
+
56
+ #define SWAP64(a) _mm_shuffle_epi32(a, 0x4E)
57
+ #define GET64LOLO(a, b) _mm_unpacklo_epi64(a, b)
58
+ #define GET64HIHI(a, b) _mm_unpackhi_epi64(a, b)
59
+ #define GET64LOHI(a, b) ((__m128i)_mm_blend_pd((__m128d)a, (__m128d)b, 2))
60
+ #define GET64HILO(a, b) SWAP64(GET64LOHI(b, a))
61
+ #define COPY64HI2LO(a) _mm_shuffle_epi32(a, 0xEE)
62
+ #define COPY64LO2HI(a) _mm_shuffle_epi32(a, 0x44)
63
+
64
+ #define ROL6464same(a, o) _mm_roti_epi64(a, o)
65
+ #define ROL6464(a, r1, r2) _mm_rot_epi64(a, CONST128( rot_##r1##_##r2 ))
66
+ ALIGN(16) const UINT64 rot_0_20[2] = { 0, 20};
67
+ ALIGN(16) const UINT64 rot_44_3[2] = {44, 3};
68
+ ALIGN(16) const UINT64 rot_43_45[2] = {43, 45};
69
+ ALIGN(16) const UINT64 rot_21_61[2] = {21, 61};
70
+ ALIGN(16) const UINT64 rot_14_28[2] = {14, 28};
71
+ ALIGN(16) const UINT64 rot_1_36[2] = { 1, 36};
72
+ ALIGN(16) const UINT64 rot_6_10[2] = { 6, 10};
73
+ ALIGN(16) const UINT64 rot_25_15[2] = {25, 15};
74
+ ALIGN(16) const UINT64 rot_8_56[2] = { 8, 56};
75
+ ALIGN(16) const UINT64 rot_18_27[2] = {18, 27};
76
+ ALIGN(16) const UINT64 rot_62_55[2] = {62, 55};
77
+ ALIGN(16) const UINT64 rot_39_41[2] = {39, 41};
78
+
79
+ /* ---------------------------------------------------------------- */
80
+
81
+ void KeccakP1600_Initialize(void *state)
82
+ {
83
+ memset(state, 0, 200);
84
+ }
85
+
86
+ /* ---------------------------------------------------------------- */
87
+
88
+ void KeccakP1600_AddBytesInLane(void *state, unsigned int lanePosition, const unsigned char *data, unsigned int offset, unsigned int length)
89
+ {
90
+ if (length == 0)
91
+ return;
92
+ UINT64 lane;
93
+ if (length == 1)
94
+ lane = data[0];
95
+ else {
96
+ lane = 0;
97
+ memcpy(&lane, data, length);
98
+ }
99
+ lane <<= offset*8;
100
+ ((UINT64*)state)[lanePosition] ^= lane;
101
+ }
102
+
103
+ /* ---------------------------------------------------------------- */
104
+
105
+ void KeccakP1600_AddLanes(void *state, const unsigned char *data, unsigned int laneCount)
106
+ {
107
+ unsigned int i = 0;
108
+ for( ; (i+8)<=laneCount; i+=8) {
109
+ ((UINT64*)state)[i+0] ^= ((UINT64*)data)[i+0];
110
+ ((UINT64*)state)[i+1] ^= ((UINT64*)data)[i+1];
111
+ ((UINT64*)state)[i+2] ^= ((UINT64*)data)[i+2];
112
+ ((UINT64*)state)[i+3] ^= ((UINT64*)data)[i+3];
113
+ ((UINT64*)state)[i+4] ^= ((UINT64*)data)[i+4];
114
+ ((UINT64*)state)[i+5] ^= ((UINT64*)data)[i+5];
115
+ ((UINT64*)state)[i+6] ^= ((UINT64*)data)[i+6];
116
+ ((UINT64*)state)[i+7] ^= ((UINT64*)data)[i+7];
117
+ }
118
+ for( ; (i+4)<=laneCount; i+=4) {
119
+ ((UINT64*)state)[i+0] ^= ((UINT64*)data)[i+0];
120
+ ((UINT64*)state)[i+1] ^= ((UINT64*)data)[i+1];
121
+ ((UINT64*)state)[i+2] ^= ((UINT64*)data)[i+2];
122
+ ((UINT64*)state)[i+3] ^= ((UINT64*)data)[i+3];
123
+ }
124
+ for( ; (i+2)<=laneCount; i+=2) {
125
+ ((UINT64*)state)[i+0] ^= ((UINT64*)data)[i+0];
126
+ ((UINT64*)state)[i+1] ^= ((UINT64*)data)[i+1];
127
+ }
128
+ if (i<laneCount) {
129
+ ((UINT64*)state)[i+0] ^= ((UINT64*)data)[i+0];
130
+ }
131
+ }
132
+
133
+ /* ---------------------------------------------------------------- */
134
+
135
+ void KeccakP1600_AddByte(void *state, unsigned char byte, unsigned int offset)
136
+ {
137
+ UINT64 lane = byte;
138
+ lane <<= (offset%8)*8;
139
+ ((UINT64*)state)[offset/8] ^= lane;
140
+ }
141
+
142
+ /* ---------------------------------------------------------------- */
143
+
144
+ void KeccakP1600_AddBytes(void *state, const unsigned char *data, unsigned int offset, unsigned int length)
145
+ {
146
+ SnP_AddBytes(state, data, offset, length, KeccakP1600_AddLanes, KeccakP1600_AddBytesInLane, 8);
147
+ }
148
+
149
+ /* ---------------------------------------------------------------- */
150
+
151
+ void KeccakP1600_OverwriteBytes(void *state, const unsigned char *data, unsigned int offset, unsigned int length)
152
+ {
153
+ memcpy((unsigned char*)state+offset, data, length);
154
+ }
155
+
156
+ /* ---------------------------------------------------------------- */
157
+
158
+ void KeccakP1600_OverwriteWithZeroes(void *state, unsigned int byteCount)
159
+ {
160
+ memset(state, 0, byteCount);
161
+ }
162
+
163
+ /* ---------------------------------------------------------------- */
164
+
165
+ #define declareABCDE \
166
+ V128 Abage, Abegi, Abigo, Abogu, Abuga; \
167
+ V128 Akame, Akemi, Akimo, Akomu, Akuma; \
168
+ V128 Abae, Abio, Agae, Agio, Akae, Akio, Amae, Amio; \
169
+ V64 Aba, Abe, Abi, Abo, Abu; \
170
+ V64 Aga, Age, Agi, Ago, Agu; \
171
+ V64 Aka, Ake, Aki, Ako, Aku; \
172
+ V64 Ama, Ame, Ami, Amo, Amu; \
173
+ V128 Asase, Asiso; \
174
+ V64 Asu; \
175
+ V128 Bbage, Bbegi, Bbigo, Bbogu, Bbuga; \
176
+ V128 Bkame, Bkemi, Bkimo, Bkomu, Bkuma; \
177
+ V128 Bsase, Bsesi, Bsiso, Bsosu, Bsusa; \
178
+ V128 Cae, Cei, Cio, Cou, Cua; \
179
+ V128 Dau, Dea, Die, Doi, Duo; \
180
+ V128 Dua, Dae, Dei, Dio, Dou; \
181
+ V128 Ebage, Ebegi, Ebigo, Ebogu, Ebuga; \
182
+ V128 Ekame, Ekemi, Ekimo, Ekomu, Ekuma; \
183
+ V128 Esase, Esiso; \
184
+ V64 Esu; \
185
+ V128 Zero;
186
+
187
+ #define prepareTheta
188
+
189
+ #define computeD \
190
+ Cua = GET64LOLO(Cua, Cae); \
191
+ Dei = XOR128(Cae, ROL6464same(Cio, 1)); \
192
+ Dou = XOR128(Cio, ROL6464same(Cua, 1)); \
193
+ Cei = GET64HILO(Cae, Cio); \
194
+ Dae = XOR128(Cua, ROL6464same(Cei, 1)); \
195
+ Dau = GET64LOHI(Dae, Dou); \
196
+ Dea = SWAP64(Dae); \
197
+ Die = SWAP64(Dei); \
198
+ Doi = GET64LOLO(Dou, Die); \
199
+ Duo = SWAP64(Dou);
200
+
201
+ /* --- Theta Rho Pi Chi Iota Prepare-theta */
202
+ /* --- 64-bit lanes mapped to 64-bit and 128-bit words */
203
+ #define thetaRhoPiChiIotaPrepareTheta(i, A, E) \
204
+ computeD \
205
+ \
206
+ Bbage = XOR128(GET64LOHI(A##bage, A##bogu), Dau); \
207
+ Bbage = ROL6464(Bbage, 0, 20); \
208
+ Bbegi = XOR128(GET64HILO(A##bage, A##kame), Dea); \
209
+ Bbegi = ROL6464(Bbegi, 44, 3); \
210
+ Bbigo = XOR128(GET64LOHI(A##kimo, A##kame), Die); \
211
+ Bbigo = ROL6464(Bbigo, 43, 45); \
212
+ E##bage = XOR128(Bbage, ANDnu128(Bbegi, Bbigo)); \
213
+ XOReq128(E##bage, CONST64(KeccakF1600RoundConstants[i])); \
214
+ Cae = E##bage; \
215
+ Bbogu = XOR128(GET64HILO(A##kimo, A##siso), Doi); \
216
+ Bbogu = ROL6464(Bbogu, 21, 61); \
217
+ E##begi = XOR128(Bbegi, ANDnu128(Bbigo, Bbogu)); \
218
+ Cei = E##begi; \
219
+ Bbuga = XOR128(GET64LOLO(A##su, A##bogu), Duo); \
220
+ Bbuga = ROL6464(Bbuga, 14, 28); \
221
+ E##bigo = XOR128(Bbigo, ANDnu128(Bbogu, Bbuga)); \
222
+ Cio = E##bigo; \
223
+ E##bogu = XOR128(Bbogu, ANDnu128(Bbuga, Bbage)); \
224
+ Cou = E##bogu; \
225
+ E##buga = XOR128(Bbuga, ANDnu128(Bbage, Bbegi)); \
226
+ Cua = E##buga; \
227
+ \
228
+ Bkame = XOR128(GET64LOHI(A##begi, A##buga), Dea); \
229
+ Bkame = ROL6464(Bkame, 1, 36); \
230
+ Bkemi = XOR128(GET64HILO(A##begi, A##kemi), Die); \
231
+ Bkemi = ROL6464(Bkemi, 6, 10); \
232
+ Bkimo = XOR128(GET64LOHI(A##komu, A##kemi), Doi); \
233
+ Bkimo = ROL6464(Bkimo, 25, 15); \
234
+ E##kame = XOR128(Bkame, ANDnu128(Bkemi, Bkimo)); \
235
+ XOReq128(Cae, E##kame); \
236
+ Bkomu = XOR128(GET64HIHI(A##komu, A##siso), Duo); \
237
+ Bkomu = ROL6464(Bkomu, 8, 56); \
238
+ E##kemi = XOR128(Bkemi, ANDnu128(Bkimo, Bkomu)); \
239
+ XOReq128(Cei, E##kemi); \
240
+ Bkuma = XOR128(GET64LOLO(A##sase, A##buga), Dau); \
241
+ Bkuma = ROL6464(Bkuma, 18, 27); \
242
+ E##kimo = XOR128(Bkimo, ANDnu128(Bkomu, Bkuma)); \
243
+ XOReq128(Cio, E##kimo); \
244
+ E##komu = XOR128(Bkomu, ANDnu128(Bkuma, Bkame)); \
245
+ XOReq128(Cou, E##komu); \
246
+ E##kuma = XOR128(Bkuma, ANDnu128(Bkame, Bkemi)); \
247
+ XOReq128(Cua, E##kuma); \
248
+ \
249
+ Bsase = XOR128(A##bigo, SWAP64(Doi)); \
250
+ Bsase = ROL6464(Bsase, 62, 55); \
251
+ Bsiso = XOR128(A##kuma, SWAP64(Dau)); \
252
+ Bsiso = ROL6464(Bsiso, 39, 41); \
253
+ Bsusa = XOR64(COPY64HI2LO(A##sase), Dei); \
254
+ Bsusa = ROL6464same(Bsusa, 2); \
255
+ Bsusa = GET64LOLO(Bsusa, Bsase); \
256
+ Bsesi = GET64HILO(Bsase, Bsiso); \
257
+ Bsosu = GET64HILO(Bsiso, Bsusa); \
258
+ E##sase = XOR128(Bsase, ANDnu128(Bsesi, Bsiso)); \
259
+ XOReq128(Cae, E##sase); \
260
+ E##siso = XOR128(Bsiso, ANDnu128(Bsosu, Bsusa)); \
261
+ XOReq128(Cio, E##siso); \
262
+ E##su = GET64LOLO(XOR128(Bsusa, ANDnu128(Bsase, Bsesi)), Zero); \
263
+ XOReq128(Cua, E##su); \
264
+ \
265
+ Zero = ZERO128(); \
266
+ XOReq128(Cae, GET64HIHI(Cua, Zero)); \
267
+ XOReq128(Cae, GET64LOLO(Zero, Cei)); \
268
+ XOReq128(Cio, GET64HIHI(Cei, Zero)); \
269
+ XOReq128(Cio, GET64LOLO(Zero, Cou)); \
270
+ XOReq128(Cua, GET64HIHI(Cou, Zero)); \
271
+
272
+ /* --- Theta Rho Pi Chi Iota */
273
+ /* --- 64-bit lanes mapped to 64-bit and 128-bit words */
274
+ #define thetaRhoPiChiIota(i, A, E) thetaRhoPiChiIotaPrepareTheta(i, A, E)
275
+
276
+ const UINT64 KeccakF1600RoundConstants[24] = {
277
+ 0x0000000000000001ULL,
278
+ 0x0000000000008082ULL,
279
+ 0x800000000000808aULL,
280
+ 0x8000000080008000ULL,
281
+ 0x000000000000808bULL,
282
+ 0x0000000080000001ULL,
283
+ 0x8000000080008081ULL,
284
+ 0x8000000000008009ULL,
285
+ 0x000000000000008aULL,
286
+ 0x0000000000000088ULL,
287
+ 0x0000000080008009ULL,
288
+ 0x000000008000000aULL,
289
+ 0x000000008000808bULL,
290
+ 0x800000000000008bULL,
291
+ 0x8000000000008089ULL,
292
+ 0x8000000000008003ULL,
293
+ 0x8000000000008002ULL,
294
+ 0x8000000000000080ULL,
295
+ 0x000000000000800aULL,
296
+ 0x800000008000000aULL,
297
+ 0x8000000080008081ULL,
298
+ 0x8000000000008080ULL,
299
+ 0x0000000080000001ULL,
300
+ 0x8000000080008008ULL };
301
+
302
+ #define copyFromState(X, state) \
303
+ X##bae = LOAD128(state[ 0]); \
304
+ X##ba = X##bae; \
305
+ X##be = GET64HIHI(X##bae, X##bae); \
306
+ Cae = X##bae; \
307
+ X##bio = LOAD128(state[ 2]); \
308
+ X##bi = X##bio; \
309
+ X##bo = GET64HIHI(X##bio, X##bio); \
310
+ Cio = X##bio; \
311
+ X##bu = LOAD64(state[ 4]); \
312
+ Cua = X##bu; \
313
+ X##gae = LOAD128u(state[ 5]); \
314
+ X##ga = X##gae; \
315
+ X##buga = GET64LOLO(X##bu, X##ga); \
316
+ X##ge = GET64HIHI(X##gae, X##gae); \
317
+ X##bage = GET64LOLO(X##ba, X##ge); \
318
+ XOReq128(Cae, X##gae); \
319
+ X##gio = LOAD128u(state[ 7]); \
320
+ X##gi = X##gio; \
321
+ X##begi = GET64LOLO(X##be, X##gi); \
322
+ X##go = GET64HIHI(X##gio, X##gio); \
323
+ X##bigo = GET64LOLO(X##bi, X##go); \
324
+ XOReq128(Cio, X##gio); \
325
+ X##gu = LOAD64(state[ 9]); \
326
+ X##bogu = GET64LOLO(X##bo, X##gu); \
327
+ XOReq64(Cua, X##gu); \
328
+ X##kae = LOAD128(state[10]); \
329
+ X##ka = X##kae; \
330
+ X##ke = GET64HIHI(X##kae, X##kae); \
331
+ XOReq128(Cae, X##kae); \
332
+ X##kio = LOAD128(state[12]); \
333
+ X##ki = X##kio; \
334
+ X##ko = GET64HIHI(X##kio, X##kio); \
335
+ XOReq128(Cio, X##kio); \
336
+ X##kuma = LOAD128(state[14]); \
337
+ XOReq64(Cua, X##kuma); \
338
+ X##me = LOAD64(state[16]); \
339
+ X##kame = GET64LOLO(X##ka, X##me); \
340
+ XOReq128(Cae, GET64HIHI(X##kuma, X##kame)); \
341
+ X##mio = LOAD128u(state[17]); \
342
+ X##mi = X##mio; \
343
+ X##kemi = GET64LOLO(X##ke, X##mi); \
344
+ X##mo = GET64HIHI(X##mio, X##mio); \
345
+ X##kimo = GET64LOLO(X##ki, X##mo); \
346
+ XOReq128(Cio, X##mio); \
347
+ X##mu = LOAD64(state[19]); \
348
+ X##komu = GET64LOLO(X##ko, X##mu); \
349
+ XOReq64(Cua, X##mu); \
350
+ X##sase = LOAD128(state[20]); \
351
+ XOReq128(Cae, X##sase); \
352
+ X##siso = LOAD128(state[22]); \
353
+ XOReq128(Cio, X##siso); \
354
+ X##su = LOAD64(state[24]); \
355
+ XOReq64(Cua, X##su); \
356
+
357
+ #define copyToState(state, X) \
358
+ STORE64(state[ 0], X##bage); \
359
+ STORE64(state[ 1], X##begi); \
360
+ STORE64(state[ 2], X##bigo); \
361
+ STORE64(state[ 3], X##bogu); \
362
+ STORE128(state[ 4], X##buga); \
363
+ STORE64(state[ 6], COPY64HI2LO(X##bage)); \
364
+ STORE64(state[ 7], COPY64HI2LO(X##begi)); \
365
+ STORE64(state[ 8], COPY64HI2LO(X##bigo)); \
366
+ STORE64(state[ 9], COPY64HI2LO(X##bogu)); \
367
+ STORE64(state[10], X##kame); \
368
+ STORE64(state[11], X##kemi); \
369
+ STORE64(state[12], X##kimo); \
370
+ STORE64(state[13], X##komu); \
371
+ STORE128(state[14], X##kuma); \
372
+ STORE64(state[16], COPY64HI2LO(X##kame)); \
373
+ STORE64(state[17], COPY64HI2LO(X##kemi)); \
374
+ STORE64(state[18], COPY64HI2LO(X##kimo)); \
375
+ STORE64(state[19], COPY64HI2LO(X##komu)); \
376
+ STORE128(state[20], X##sase); \
377
+ STORE128(state[22], X##siso); \
378
+ STORE64(state[24], X##su); \
379
+
380
+ #define copyStateVariables(X, Y) \
381
+ X##bage = Y##bage; \
382
+ X##begi = Y##begi; \
383
+ X##bigo = Y##bigo; \
384
+ X##bogu = Y##bogu; \
385
+ X##buga = Y##buga; \
386
+ X##kame = Y##kame; \
387
+ X##kemi = Y##kemi; \
388
+ X##kimo = Y##kimo; \
389
+ X##komu = Y##komu; \
390
+ X##kuma = Y##kuma; \
391
+ X##sase = Y##sase; \
392
+ X##siso = Y##siso; \
393
+ X##su = Y##su; \
394
+
395
+ /* ---------------------------------------------------------------- */
396
+
397
+ void KeccakP1600_Permute_Nrounds(void *state, unsigned int nr)
398
+ {
399
+ declareABCDE
400
+ unsigned int i;
401
+ UINT64 *stateAsLanes = (UINT64*)state;
402
+
403
+ copyFromState(A, stateAsLanes)
404
+ roundsN(nr)
405
+ copyToState(stateAsLanes, A)
406
+ }
407
+
408
+ /* ---------------------------------------------------------------- */
409
+
410
+ void KeccakP1600_Permute_12rounds(void *state)
411
+ {
412
+ declareABCDE
413
+ #ifndef KeccakP1600_fullUnrolling
414
+ unsigned int i;
415
+ #endif
416
+ UINT64 *stateAsLanes = (UINT64*)state;
417
+
418
+ copyFromState(A, stateAsLanes)
419
+ rounds12
420
+ copyToState(stateAsLanes, A)
421
+ }
422
+
423
+ /* ---------------------------------------------------------------- */
424
+
425
+ void KeccakP1600_Permute_24rounds(void *state)
426
+ {
427
+ declareABCDE
428
+ #ifndef KeccakP1600_fullUnrolling
429
+ unsigned int i;
430
+ #endif
431
+ UINT64 *stateAsLanes = (UINT64*)state;
432
+
433
+ copyFromState(A, stateAsLanes)
434
+ rounds24
435
+ copyToState(stateAsLanes, A)
436
+ }
437
+
438
+ /* ---------------------------------------------------------------- */
439
+
440
+ void KeccakP1600_ExtractBytes(const void *state, unsigned char *data, unsigned int offset, unsigned int length)
441
+ {
442
+ memcpy(data, (const unsigned char *)state+offset, length);
443
+ }
444
+
445
+ /* ---------------------------------------------------------------- */
446
+
447
+ void KeccakP1600_ExtractAndAddBytesInLane(const void *state, unsigned int lanePosition, const unsigned char *input, unsigned char *output, unsigned int offset, unsigned int length)
448
+ {
449
+ UINT64 lane = ((UINT64*)state)[lanePosition];
450
+ unsigned int i;
451
+ UINT64 lane1[1];
452
+ lane1[0] = lane;
453
+ for(i=0; i<length; i++)
454
+ output[i] = input[i] ^ ((UINT8*)lane1)[offset+i];
455
+ }
456
+
457
+ /* ---------------------------------------------------------------- */
458
+
459
+ void KeccakP1600_ExtractAndAddLanes(const void *state, const unsigned char *input, unsigned char *output, unsigned int laneCount)
460
+ {
461
+ unsigned int i;
462
+
463
+ for(i=0; i<laneCount; i++) {
464
+ ((UINT64*)output)[i] = ((UINT64*)input)[i] ^ ((const UINT64*)state)[i];
465
+ }
466
+ }
467
+
468
+ /* ---------------------------------------------------------------- */
469
+
470
+ void KeccakP1600_ExtractAndAddBytes(const void *state, const unsigned char *input, unsigned char *output, unsigned int offset, unsigned int length)
471
+ {
472
+ SnP_ExtractAndAddBytes(state, input, output, offset, length, KeccakP1600_ExtractAndAddLanes, KeccakP1600_ExtractAndAddBytesInLane, 8);
473
+ }