sleeping_kangaroo12 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (284) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +127 -0
  3. data/ext/Rakefile +73 -0
  4. data/ext/binding/sleeping_kangaroo12.c +39 -0
  5. data/ext/config/xkcp.build +17 -0
  6. data/ext/xkcp/LICENSE +1 -0
  7. data/ext/xkcp/Makefile +15 -0
  8. data/ext/xkcp/Makefile.build +200 -0
  9. data/ext/xkcp/README.markdown +296 -0
  10. data/ext/xkcp/lib/HighLevel.build +143 -0
  11. data/ext/xkcp/lib/LowLevel.build +757 -0
  12. data/ext/xkcp/lib/common/align.h +33 -0
  13. data/ext/xkcp/lib/common/brg_endian.h +143 -0
  14. data/ext/xkcp/lib/high/KangarooTwelve/KangarooTwelve.c +301 -0
  15. data/ext/xkcp/lib/high/KangarooTwelve/KangarooTwelve.h +97 -0
  16. data/ext/xkcp/lib/high/Keccak/FIPS202/KeccakHash.c +81 -0
  17. data/ext/xkcp/lib/high/Keccak/FIPS202/KeccakHash.h +125 -0
  18. data/ext/xkcp/lib/high/Keccak/FIPS202/SimpleFIPS202.c +48 -0
  19. data/ext/xkcp/lib/high/Keccak/FIPS202/SimpleFIPS202.h +79 -0
  20. data/ext/xkcp/lib/high/Keccak/KeccakDuplex.c +81 -0
  21. data/ext/xkcp/lib/high/Keccak/KeccakDuplex.h +73 -0
  22. data/ext/xkcp/lib/high/Keccak/KeccakDuplex.inc +195 -0
  23. data/ext/xkcp/lib/high/Keccak/KeccakSponge.c +111 -0
  24. data/ext/xkcp/lib/high/Keccak/KeccakSponge.h +76 -0
  25. data/ext/xkcp/lib/high/Keccak/KeccakSponge.inc +314 -0
  26. data/ext/xkcp/lib/high/Keccak/PRG/KeccakPRG.c +61 -0
  27. data/ext/xkcp/lib/high/Keccak/PRG/KeccakPRG.h +67 -0
  28. data/ext/xkcp/lib/high/Keccak/PRG/KeccakPRG.inc +128 -0
  29. data/ext/xkcp/lib/high/Keccak/SP800-185/SP800-185.c +93 -0
  30. data/ext/xkcp/lib/high/Keccak/SP800-185/SP800-185.h +599 -0
  31. data/ext/xkcp/lib/high/Keccak/SP800-185/SP800-185.inc +573 -0
  32. data/ext/xkcp/lib/high/Ketje/Ketjev2.c +87 -0
  33. data/ext/xkcp/lib/high/Ketje/Ketjev2.h +88 -0
  34. data/ext/xkcp/lib/high/Ketje/Ketjev2.inc +274 -0
  35. data/ext/xkcp/lib/high/Keyak/Keyakv2.c +132 -0
  36. data/ext/xkcp/lib/high/Keyak/Keyakv2.h +217 -0
  37. data/ext/xkcp/lib/high/Keyak/Keyakv2.inc +81 -0
  38. data/ext/xkcp/lib/high/Keyak/Motorist.inc +953 -0
  39. data/ext/xkcp/lib/high/Kravatte/Kravatte.c +533 -0
  40. data/ext/xkcp/lib/high/Kravatte/Kravatte.h +115 -0
  41. data/ext/xkcp/lib/high/Kravatte/KravatteModes.c +557 -0
  42. data/ext/xkcp/lib/high/Kravatte/KravatteModes.h +247 -0
  43. data/ext/xkcp/lib/high/Xoodyak/Cyclist.h +66 -0
  44. data/ext/xkcp/lib/high/Xoodyak/Cyclist.inc +336 -0
  45. data/ext/xkcp/lib/high/Xoodyak/Xoodyak-parameters.h +26 -0
  46. data/ext/xkcp/lib/high/Xoodyak/Xoodyak.c +55 -0
  47. data/ext/xkcp/lib/high/Xoodyak/Xoodyak.h +35 -0
  48. data/ext/xkcp/lib/high/Xoofff/Xoofff.c +634 -0
  49. data/ext/xkcp/lib/high/Xoofff/Xoofff.h +147 -0
  50. data/ext/xkcp/lib/high/Xoofff/XoofffModes.c +483 -0
  51. data/ext/xkcp/lib/high/Xoofff/XoofffModes.h +241 -0
  52. data/ext/xkcp/lib/high/common/Phases.h +25 -0
  53. data/ext/xkcp/lib/low/KeccakP-1600/ARM/KeccakP-1600-SnP.h +41 -0
  54. data/ext/xkcp/lib/low/KeccakP-1600/ARM/KeccakP-1600-inplace-32bi-armv6m-le-armcc.s +1666 -0
  55. data/ext/xkcp/lib/low/KeccakP-1600/ARM/KeccakP-1600-inplace-32bi-armv6m-le-gcc.s +1655 -0
  56. data/ext/xkcp/lib/low/KeccakP-1600/ARM/KeccakP-1600-inplace-32bi-armv7a-le-armcc.s +1268 -0
  57. data/ext/xkcp/lib/low/KeccakP-1600/ARM/KeccakP-1600-inplace-32bi-armv7a-le-gcc.s +1264 -0
  58. data/ext/xkcp/lib/low/KeccakP-1600/ARM/KeccakP-1600-inplace-32bi-armv7m-le-armcc.s +1178 -0
  59. data/ext/xkcp/lib/low/KeccakP-1600/ARM/KeccakP-1600-inplace-32bi-armv7m-le-gcc.s +1175 -0
  60. data/ext/xkcp/lib/low/KeccakP-1600/ARM/KeccakP-1600-u1-32bi-armv6m-le-armcc.s +1338 -0
  61. data/ext/xkcp/lib/low/KeccakP-1600/ARM/KeccakP-1600-u1-32bi-armv6m-le-gcc.s +1336 -0
  62. data/ext/xkcp/lib/low/KeccakP-1600/ARM/KeccakP-1600-u2-32bi-armv6m-le-armcc.s +1343 -0
  63. data/ext/xkcp/lib/low/KeccakP-1600/ARM/KeccakP-1600-u2-32bi-armv6m-le-gcc.s +1339 -0
  64. data/ext/xkcp/lib/low/KeccakP-1600/ARMv7A-NEON/KeccakP-1600-SnP.h +42 -0
  65. data/ext/xkcp/lib/low/KeccakP-1600/ARMv7A-NEON/KeccakP-1600-armv7a-le-neon-armcc.s +823 -0
  66. data/ext/xkcp/lib/low/KeccakP-1600/ARMv7A-NEON/KeccakP-1600-armv7a-le-neon-gcc.s +831 -0
  67. data/ext/xkcp/lib/low/KeccakP-1600/ARMv8A/KeccakP-1600-SnP.h +31 -0
  68. data/ext/xkcp/lib/low/KeccakP-1600/ARMv8A/KeccakP-1600-armv8a-neon.s +540 -0
  69. data/ext/xkcp/lib/low/KeccakP-1600/AVR8/KeccakP-1600-SnP.h +42 -0
  70. data/ext/xkcp/lib/low/KeccakP-1600/AVR8/KeccakP-1600-avr8-compact.s +733 -0
  71. data/ext/xkcp/lib/low/KeccakP-1600/AVR8/KeccakP-1600-avr8-fast.s +1121 -0
  72. data/ext/xkcp/lib/low/KeccakP-1600/AVX2/KeccakP-1600-AVX2.s +1100 -0
  73. data/ext/xkcp/lib/low/KeccakP-1600/AVX2/KeccakP-1600-SnP.h +52 -0
  74. data/ext/xkcp/lib/low/KeccakP-1600/AVX512/C/KeccakP-1600-AVX512.c +623 -0
  75. data/ext/xkcp/lib/low/KeccakP-1600/AVX512/C/KeccakP-1600-SnP.h +47 -0
  76. data/ext/xkcp/lib/low/KeccakP-1600/AVX512/C/u12/KeccakP-1600-AVX512-config.h +6 -0
  77. data/ext/xkcp/lib/low/KeccakP-1600/AVX512/C/u6/KeccakP-1600-AVX512-config.h +6 -0
  78. data/ext/xkcp/lib/low/KeccakP-1600/AVX512/C/ua/KeccakP-1600-AVX512-config.h +6 -0
  79. data/ext/xkcp/lib/low/KeccakP-1600/AVX512/KeccakP-1600-AVX512.s +1031 -0
  80. data/ext/xkcp/lib/low/KeccakP-1600/AVX512/KeccakP-1600-SnP.h +53 -0
  81. data/ext/xkcp/lib/low/KeccakP-1600/XOP/KeccakP-1600-SnP.h +44 -0
  82. data/ext/xkcp/lib/low/KeccakP-1600/XOP/KeccakP-1600-XOP.c +476 -0
  83. data/ext/xkcp/lib/low/KeccakP-1600/XOP/u6/KeccakP-1600-XOP-config.h +6 -0
  84. data/ext/xkcp/lib/low/KeccakP-1600/XOP/ua/KeccakP-1600-XOP-config.h +6 -0
  85. data/ext/xkcp/lib/low/KeccakP-1600/common/KeccakP-1600-64.macros +748 -0
  86. data/ext/xkcp/lib/low/KeccakP-1600/common/KeccakP-1600-unrolling.macros +305 -0
  87. data/ext/xkcp/lib/low/KeccakP-1600/compact/KeccakP-1600-SnP.h +40 -0
  88. data/ext/xkcp/lib/low/KeccakP-1600/compact/KeccakP-1600-compact64.c +420 -0
  89. data/ext/xkcp/lib/low/KeccakP-1600/plain-32bits-inplace/KeccakP-1600-SnP.h +43 -0
  90. data/ext/xkcp/lib/low/KeccakP-1600/plain-32bits-inplace/KeccakP-1600-inplace32BI.c +1163 -0
  91. data/ext/xkcp/lib/low/KeccakP-1600/plain-64bits/KeccakP-1600-SnP.h +54 -0
  92. data/ext/xkcp/lib/low/KeccakP-1600/plain-64bits/KeccakP-1600-opt64.c +565 -0
  93. data/ext/xkcp/lib/low/KeccakP-1600/plain-64bits/lcu6/KeccakP-1600-opt64-config.h +7 -0
  94. data/ext/xkcp/lib/low/KeccakP-1600/plain-64bits/lcua/KeccakP-1600-opt64-config.h +7 -0
  95. data/ext/xkcp/lib/low/KeccakP-1600/plain-64bits/lcua-shld/KeccakP-1600-opt64-config.h +8 -0
  96. data/ext/xkcp/lib/low/KeccakP-1600/plain-64bits/u6/KeccakP-1600-opt64-config.h +6 -0
  97. data/ext/xkcp/lib/low/KeccakP-1600/plain-64bits/ua/KeccakP-1600-opt64-config.h +6 -0
  98. data/ext/xkcp/lib/low/KeccakP-1600/ref-32bits/KeccakP-1600-SnP.h +44 -0
  99. data/ext/xkcp/lib/low/KeccakP-1600/ref-32bits/KeccakP-1600-reference.h +23 -0
  100. data/ext/xkcp/lib/low/KeccakP-1600/ref-32bits/KeccakP-1600-reference32BI.c +625 -0
  101. data/ext/xkcp/lib/low/KeccakP-1600/ref-64bits/KeccakP-1600-SnP.h +44 -0
  102. data/ext/xkcp/lib/low/KeccakP-1600/ref-64bits/KeccakP-1600-reference.c +440 -0
  103. data/ext/xkcp/lib/low/KeccakP-1600/ref-64bits/KeccakP-1600-reference.h +23 -0
  104. data/ext/xkcp/lib/low/KeccakP-1600/x86-64/KeccakP-1600-SnP.h +42 -0
  105. data/ext/xkcp/lib/low/KeccakP-1600/x86-64/KeccakP-1600-x86-64-gas.s +1196 -0
  106. data/ext/xkcp/lib/low/KeccakP-1600/x86-64/KeccakP-1600-x86-64-gas_Apple.s +1124 -0
  107. data/ext/xkcp/lib/low/KeccakP-1600/x86-64/KeccakP-1600-x86-64-shld-gas.s +1196 -0
  108. data/ext/xkcp/lib/low/KeccakP-1600-times2/ARMv7A-NEON/KeccakP-1600-inplace-pl2-armv7a-neon-le-armcc.s +1392 -0
  109. data/ext/xkcp/lib/low/KeccakP-1600-times2/ARMv7A-NEON/KeccakP-1600-inplace-pl2-armv7a-neon-le-gcc.s +1394 -0
  110. data/ext/xkcp/lib/low/KeccakP-1600-times2/ARMv7A-NEON/KeccakP-1600-times2-SnP.h +42 -0
  111. data/ext/xkcp/lib/low/KeccakP-1600-times2/AVX512/AVX512u12/SIMD512-2-config.h +7 -0
  112. data/ext/xkcp/lib/low/KeccakP-1600-times2/AVX512/AVX512u4/SIMD512-2-config.h +7 -0
  113. data/ext/xkcp/lib/low/KeccakP-1600-times2/AVX512/AVX512ufull/SIMD512-2-config.h +7 -0
  114. data/ext/xkcp/lib/low/KeccakP-1600-times2/AVX512/KeccakP-1600-times2-SIMD512.c +850 -0
  115. data/ext/xkcp/lib/low/KeccakP-1600-times2/AVX512/KeccakP-1600-times2-SnP.h +51 -0
  116. data/ext/xkcp/lib/low/KeccakP-1600-times2/SIMD128/KeccakP-1600-times2-SIMD128.c +957 -0
  117. data/ext/xkcp/lib/low/KeccakP-1600-times2/SIMD128/KeccakP-1600-times2-SnP.h +49 -0
  118. data/ext/xkcp/lib/low/KeccakP-1600-times2/SIMD128/SSSE3-u2/SIMD128-config.h +8 -0
  119. data/ext/xkcp/lib/low/KeccakP-1600-times2/SIMD128/SSSE3-ua/SIMD128-config.h +8 -0
  120. data/ext/xkcp/lib/low/KeccakP-1600-times2/SIMD128/XOP-u2/SIMD128-config.h +9 -0
  121. data/ext/xkcp/lib/low/KeccakP-1600-times2/SIMD128/XOP-ua/SIMD128-config.h +9 -0
  122. data/ext/xkcp/lib/low/KeccakP-1600-times2/fallback-on1/KeccakP-1600-times2-SnP.h +45 -0
  123. data/ext/xkcp/lib/low/KeccakP-1600-times2/fallback-on1/KeccakP-1600-times2-on1.c +37 -0
  124. data/ext/xkcp/lib/low/KeccakP-1600-times4/AVX2/KeccakP-1600-times4-SIMD256.c +1321 -0
  125. data/ext/xkcp/lib/low/KeccakP-1600-times4/AVX2/KeccakP-1600-times4-SnP.h +55 -0
  126. data/ext/xkcp/lib/low/KeccakP-1600-times4/AVX2/u12/SIMD256-config.h +7 -0
  127. data/ext/xkcp/lib/low/KeccakP-1600-times4/AVX2/u6/SIMD256-config.h +7 -0
  128. data/ext/xkcp/lib/low/KeccakP-1600-times4/AVX2/ua/SIMD256-config.h +7 -0
  129. data/ext/xkcp/lib/low/KeccakP-1600-times4/AVX512/AVX512u12/SIMD512-4-config.h +7 -0
  130. data/ext/xkcp/lib/low/KeccakP-1600-times4/AVX512/AVX512u4/SIMD512-4-config.h +7 -0
  131. data/ext/xkcp/lib/low/KeccakP-1600-times4/AVX512/AVX512ufull/SIMD512-4-config.h +7 -0
  132. data/ext/xkcp/lib/low/KeccakP-1600-times4/AVX512/KeccakP-1600-times4-SIMD512.c +881 -0
  133. data/ext/xkcp/lib/low/KeccakP-1600-times4/AVX512/KeccakP-1600-times4-SnP.h +51 -0
  134. data/ext/xkcp/lib/low/KeccakP-1600-times4/fallback-on1/KeccakP-1600-times4-SnP.h +45 -0
  135. data/ext/xkcp/lib/low/KeccakP-1600-times4/fallback-on1/KeccakP-1600-times4-on1.c +37 -0
  136. data/ext/xkcp/lib/low/KeccakP-1600-times4/fallback-on2/KeccakP-1600-times4-SnP.h +45 -0
  137. data/ext/xkcp/lib/low/KeccakP-1600-times4/fallback-on2/KeccakP-1600-times4-on2.c +38 -0
  138. data/ext/xkcp/lib/low/KeccakP-1600-times8/AVX512/KeccakP-1600-times8-SIMD512.c +1615 -0
  139. data/ext/xkcp/lib/low/KeccakP-1600-times8/AVX512/KeccakP-1600-times8-SnP.h +57 -0
  140. data/ext/xkcp/lib/low/KeccakP-1600-times8/AVX512/u12/SIMD512-config.h +7 -0
  141. data/ext/xkcp/lib/low/KeccakP-1600-times8/AVX512/u4/SIMD512-config.h +7 -0
  142. data/ext/xkcp/lib/low/KeccakP-1600-times8/AVX512/ua/SIMD512-config.h +7 -0
  143. data/ext/xkcp/lib/low/KeccakP-1600-times8/fallback-on1/KeccakP-1600-times8-SnP.h +45 -0
  144. data/ext/xkcp/lib/low/KeccakP-1600-times8/fallback-on1/KeccakP-1600-times8-on1.c +37 -0
  145. data/ext/xkcp/lib/low/KeccakP-1600-times8/fallback-on2/KeccakP-1600-times8-SnP.h +45 -0
  146. data/ext/xkcp/lib/low/KeccakP-1600-times8/fallback-on2/KeccakP-1600-times8-on2.c +38 -0
  147. data/ext/xkcp/lib/low/KeccakP-1600-times8/fallback-on4/KeccakP-1600-times8-SnP.h +45 -0
  148. data/ext/xkcp/lib/low/KeccakP-1600-times8/fallback-on4/KeccakP-1600-times8-on4.c +38 -0
  149. data/ext/xkcp/lib/low/KeccakP-200/ARM/KeccakP-200-SnP.h +41 -0
  150. data/ext/xkcp/lib/low/KeccakP-200/ARM/KeccakP-200-armv6m-le-armcc.s +442 -0
  151. data/ext/xkcp/lib/low/KeccakP-200/ARM/KeccakP-200-armv6m-le-gcc.s +446 -0
  152. data/ext/xkcp/lib/low/KeccakP-200/ARM/KeccakP-200-armv7m-le-armcc.s +419 -0
  153. data/ext/xkcp/lib/low/KeccakP-200/ARM/KeccakP-200-armv7m-le-gcc.s +427 -0
  154. data/ext/xkcp/lib/low/KeccakP-200/AVR8/KeccakP-200-SnP.h +41 -0
  155. data/ext/xkcp/lib/low/KeccakP-200/AVR8/KeccakP-200-avr8-fast.s +647 -0
  156. data/ext/xkcp/lib/low/KeccakP-200/compact/KeccakP-200-SnP.h +39 -0
  157. data/ext/xkcp/lib/low/KeccakP-200/compact/KeccakP-200-compact.c +190 -0
  158. data/ext/xkcp/lib/low/KeccakP-200/ref/KeccakP-200-SnP.h +43 -0
  159. data/ext/xkcp/lib/low/KeccakP-200/ref/KeccakP-200-reference.c +412 -0
  160. data/ext/xkcp/lib/low/KeccakP-200/ref/KeccakP-200-reference.h +23 -0
  161. data/ext/xkcp/lib/low/KeccakP-400/ARM/KeccakP-400-SnP.h +41 -0
  162. data/ext/xkcp/lib/low/KeccakP-400/ARM/KeccakP-400-armv6m-le-armcc.s +454 -0
  163. data/ext/xkcp/lib/low/KeccakP-400/ARM/KeccakP-400-armv6m-le-gcc.s +458 -0
  164. data/ext/xkcp/lib/low/KeccakP-400/ARM/KeccakP-400-armv7m-le-armcc.s +455 -0
  165. data/ext/xkcp/lib/low/KeccakP-400/ARM/KeccakP-400-armv7m-le-gcc.s +458 -0
  166. data/ext/xkcp/lib/low/KeccakP-400/AVR8/KeccakP-400-SnP.h +41 -0
  167. data/ext/xkcp/lib/low/KeccakP-400/AVR8/KeccakP-400-avr8-fast.s +728 -0
  168. data/ext/xkcp/lib/low/KeccakP-400/ref/KeccakP-400-SnP.h +43 -0
  169. data/ext/xkcp/lib/low/KeccakP-400/ref/KeccakP-400-reference.c +414 -0
  170. data/ext/xkcp/lib/low/KeccakP-400/ref/KeccakP-400-reference.h +23 -0
  171. data/ext/xkcp/lib/low/KeccakP-800/ARM/KeccakP-800-SnP.h +42 -0
  172. data/ext/xkcp/lib/low/KeccakP-800/ARM/KeccakP-800-u1-armv6m-le-armcc.s +527 -0
  173. data/ext/xkcp/lib/low/KeccakP-800/ARM/KeccakP-800-u1-armv6m-le-gcc.s +533 -0
  174. data/ext/xkcp/lib/low/KeccakP-800/ARM/KeccakP-800-u2-armv6m-le-armcc.s +528 -0
  175. data/ext/xkcp/lib/low/KeccakP-800/ARM/KeccakP-800-u2-armv6m-le-gcc.s +534 -0
  176. data/ext/xkcp/lib/low/KeccakP-800/ARM/KeccakP-800-u2-armv7a-le-armcc.s +521 -0
  177. data/ext/xkcp/lib/low/KeccakP-800/ARM/KeccakP-800-u2-armv7a-le-gcc.s +527 -0
  178. data/ext/xkcp/lib/low/KeccakP-800/ARM/KeccakP-800-u2-armv7m-le-armcc.s +517 -0
  179. data/ext/xkcp/lib/low/KeccakP-800/ARM/KeccakP-800-u2-armv7m-le-gcc.s +523 -0
  180. data/ext/xkcp/lib/low/KeccakP-800/ARM/KeccakP-800-uf-armv7m-le-armcc.s +550 -0
  181. data/ext/xkcp/lib/low/KeccakP-800/ARM/KeccakP-800-uf-armv7m-le-gcc.s +556 -0
  182. data/ext/xkcp/lib/low/KeccakP-800/ARMv8A/KeccakP-800-SnP.h +32 -0
  183. data/ext/xkcp/lib/low/KeccakP-800/ARMv8A/KeccakP-800-armv8a-neon.s +432 -0
  184. data/ext/xkcp/lib/low/KeccakP-800/AVR8/KeccakP-800-SnP.h +42 -0
  185. data/ext/xkcp/lib/low/KeccakP-800/AVR8/KeccakP-800-avr8-fast.s +929 -0
  186. data/ext/xkcp/lib/low/KeccakP-800/compact/KeccakP-800-SnP.h +40 -0
  187. data/ext/xkcp/lib/low/KeccakP-800/compact/KeccakP-800-compact.c +244 -0
  188. data/ext/xkcp/lib/low/KeccakP-800/plain/KeccakP-800-SnP.h +46 -0
  189. data/ext/xkcp/lib/low/KeccakP-800/plain/KeccakP-800-opt32-bis.macros +184 -0
  190. data/ext/xkcp/lib/low/KeccakP-800/plain/KeccakP-800-opt32.c +454 -0
  191. data/ext/xkcp/lib/low/KeccakP-800/plain/KeccakP-800-opt32.macros +459 -0
  192. data/ext/xkcp/lib/low/KeccakP-800/plain/KeccakP-800-unrolling-bis.macros +83 -0
  193. data/ext/xkcp/lib/low/KeccakP-800/plain/KeccakP-800-unrolling.macros +88 -0
  194. data/ext/xkcp/lib/low/KeccakP-800/plain/lcu2/KeccakP-800-opt32-config.h +7 -0
  195. data/ext/xkcp/lib/low/KeccakP-800/plain/lcua/KeccakP-800-opt32-config.h +7 -0
  196. data/ext/xkcp/lib/low/KeccakP-800/plain/u2/KeccakP-800-opt32-config.h +7 -0
  197. data/ext/xkcp/lib/low/KeccakP-800/plain/ua/KeccakP-800-opt32-config.h +7 -0
  198. data/ext/xkcp/lib/low/KeccakP-800/ref/KeccakP-800-SnP.h +44 -0
  199. data/ext/xkcp/lib/low/KeccakP-800/ref/KeccakP-800-reference.c +437 -0
  200. data/ext/xkcp/lib/low/KeccakP-800/ref/KeccakP-800-reference.h +23 -0
  201. data/ext/xkcp/lib/low/Ketje/OptimizedAsmARM/Ket.h +57 -0
  202. data/ext/xkcp/lib/low/Ketje/OptimizedAsmARM/KetjeJr-armv7m-le-armcc.s +475 -0
  203. data/ext/xkcp/lib/low/Ketje/OptimizedAsmARM/KetjeJr-armv7m-le-gcc.s +480 -0
  204. data/ext/xkcp/lib/low/Ketje/OptimizedAsmARM/KetjeSr-armv7m-le-armcc.s +590 -0
  205. data/ext/xkcp/lib/low/Ketje/OptimizedAsmARM/KetjeSr-armv7m-le-gcc.s +590 -0
  206. data/ext/xkcp/lib/low/Ketje/OptimizedLE/Ket.c +126 -0
  207. data/ext/xkcp/lib/low/Ketje/OptimizedLE/Ket.h +68 -0
  208. data/ext/xkcp/lib/low/Ketje/OptimizedLE/Ket.inc +174 -0
  209. data/ext/xkcp/lib/low/Ketje/SnP-compliant/Ket.c +80 -0
  210. data/ext/xkcp/lib/low/Ketje/SnP-compliant/Ket.h +68 -0
  211. data/ext/xkcp/lib/low/Ketje/SnP-compliant/Ket.inc +142 -0
  212. data/ext/xkcp/lib/low/Xoodoo/ARM/Xoodoo-SnP.h +55 -0
  213. data/ext/xkcp/lib/low/Xoodoo/ARM/Xoodoo-u1-armv6m-le-armcc.s +1086 -0
  214. data/ext/xkcp/lib/low/Xoodoo/ARM/Xoodoo-u1-armv6m-le-gcc.s +1092 -0
  215. data/ext/xkcp/lib/low/Xoodoo/ARM/Xoodoo-uf-armv6-le-armcc.s +721 -0
  216. data/ext/xkcp/lib/low/Xoodoo/ARM/Xoodoo-uf-armv6-le-gcc.s +726 -0
  217. data/ext/xkcp/lib/low/Xoodoo/ARM/Xoodoo-uf-armv7m-le-armcc.s +723 -0
  218. data/ext/xkcp/lib/low/Xoodoo/ARM/Xoodoo-uf-armv7m-le-gcc.s +729 -0
  219. data/ext/xkcp/lib/low/Xoodoo/ARM/Xoodyak-u1-armv6m-le-armcc.s +1164 -0
  220. data/ext/xkcp/lib/low/Xoodoo/ARM/Xoodyak-u1-armv6m-le-gcc.s +1165 -0
  221. data/ext/xkcp/lib/low/Xoodoo/ARM/Xoodyak-uf-armv6-le-armcc.s +562 -0
  222. data/ext/xkcp/lib/low/Xoodoo/ARM/Xoodyak-uf-armv6-le-gcc.s +563 -0
  223. data/ext/xkcp/lib/low/Xoodoo/ARM/Xoodyak-uf-armv7m-le-armcc.s +563 -0
  224. data/ext/xkcp/lib/low/Xoodoo/ARM/Xoodyak-uf-armv7m-le-gcc.s +565 -0
  225. data/ext/xkcp/lib/low/Xoodoo/ARMv7A-NEON/Xoodoo-SnP.h +55 -0
  226. data/ext/xkcp/lib/low/Xoodoo/ARMv7A-NEON/Xoodoo-uf-armv7a-neon-le-armcc.s +476 -0
  227. data/ext/xkcp/lib/low/Xoodoo/ARMv7A-NEON/Xoodoo-uf-armv7a-neon-le-gcc.s +485 -0
  228. data/ext/xkcp/lib/low/Xoodoo/ARMv7A-NEON/Xoodyak-uf-armv7a-neon-le-armcc.s +362 -0
  229. data/ext/xkcp/lib/low/Xoodoo/ARMv7A-NEON/Xoodyak-uf-armv7a-neon-le-gcc.s +367 -0
  230. data/ext/xkcp/lib/low/Xoodoo/AVR8/Xoodoo-SnP.h +43 -0
  231. data/ext/xkcp/lib/low/Xoodoo/AVR8/Xoodoo-avr8-u1.s +1341 -0
  232. data/ext/xkcp/lib/low/Xoodoo/AVX512/Xoodoo-SIMD512.c +581 -0
  233. data/ext/xkcp/lib/low/Xoodoo/AVX512/Xoodoo-SnP.h +58 -0
  234. data/ext/xkcp/lib/low/Xoodoo/AVX512/Xoodyak-full-block-SIMD512.c +332 -0
  235. data/ext/xkcp/lib/low/Xoodoo/SSE2/Xoodoo-SIMD128.c +329 -0
  236. data/ext/xkcp/lib/low/Xoodoo/SSE2/Xoodoo-SnP.h +53 -0
  237. data/ext/xkcp/lib/low/Xoodoo/SSE2/Xoodyak-full-block-SIMD128.c +355 -0
  238. data/ext/xkcp/lib/low/Xoodoo/Xoodoo.h +79 -0
  239. data/ext/xkcp/lib/low/Xoodoo/plain/Xoodoo-SnP.h +56 -0
  240. data/ext/xkcp/lib/low/Xoodoo/plain/Xoodoo-optimized.c +399 -0
  241. data/ext/xkcp/lib/low/Xoodoo/plain/Xoodyak-full-blocks.c +127 -0
  242. data/ext/xkcp/lib/low/Xoodoo/ref/Xoodoo-SnP.h +43 -0
  243. data/ext/xkcp/lib/low/Xoodoo/ref/Xoodoo-reference.c +253 -0
  244. data/ext/xkcp/lib/low/Xoodoo-times16/AVX512/Xoodoo-times16-SIMD512.c +1044 -0
  245. data/ext/xkcp/lib/low/Xoodoo-times16/AVX512/Xoodoo-times16-SnP.h +49 -0
  246. data/ext/xkcp/lib/low/Xoodoo-times16/fallback-on1/Xoodoo-times16-SnP.h +45 -0
  247. data/ext/xkcp/lib/low/Xoodoo-times16/fallback-on1/Xoodoo-times16-on1.c +37 -0
  248. data/ext/xkcp/lib/low/Xoodoo-times4/ARMv7A-NEON/Xoodoo-times4-ARMv7A.s +1587 -0
  249. data/ext/xkcp/lib/low/Xoodoo-times4/ARMv7A-NEON/Xoodoo-times4-SnP.h +48 -0
  250. data/ext/xkcp/lib/low/Xoodoo-times4/AVX512/Xoodoo-times4-SIMD512.c +1202 -0
  251. data/ext/xkcp/lib/low/Xoodoo-times4/AVX512/Xoodoo-times4-SnP.h +48 -0
  252. data/ext/xkcp/lib/low/Xoodoo-times4/SSSE3/Xoodoo-times4-SIMD128.c +484 -0
  253. data/ext/xkcp/lib/low/Xoodoo-times4/SSSE3/Xoodoo-times4-SnP.h +44 -0
  254. data/ext/xkcp/lib/low/Xoodoo-times4/fallback-on1/Xoodoo-times4-SnP.h +45 -0
  255. data/ext/xkcp/lib/low/Xoodoo-times4/fallback-on1/Xoodoo-times4-on1.c +37 -0
  256. data/ext/xkcp/lib/low/Xoodoo-times8/AVX2/Xoodoo-times8-SIMD256.c +939 -0
  257. data/ext/xkcp/lib/low/Xoodoo-times8/AVX2/Xoodoo-times8-SnP.h +49 -0
  258. data/ext/xkcp/lib/low/Xoodoo-times8/AVX512/Xoodoo-times8-SIMD512.c +1216 -0
  259. data/ext/xkcp/lib/low/Xoodoo-times8/AVX512/Xoodoo-times8-SnP.h +48 -0
  260. data/ext/xkcp/lib/low/Xoodoo-times8/fallback-on1/Xoodoo-times8-SnP.h +45 -0
  261. data/ext/xkcp/lib/low/Xoodoo-times8/fallback-on1/Xoodoo-times8-on1.c +37 -0
  262. data/ext/xkcp/lib/low/common/PlSnP-Fallback.inc +290 -0
  263. data/ext/xkcp/lib/low/common/SnP-Relaned.h +141 -0
  264. data/ext/xkcp/support/Build/ExpandProducts.xsl +79 -0
  265. data/ext/xkcp/support/Build/ToGlobalMakefile.xsl +206 -0
  266. data/ext/xkcp/support/Build/ToOneTarget.xsl +89 -0
  267. data/ext/xkcp/support/Build/ToTargetConfigFile.xsl +37 -0
  268. data/ext/xkcp/support/Build/ToTargetMakefile.xsl +298 -0
  269. data/ext/xkcp/support/Build/ToVCXProj.xsl +198 -0
  270. data/ext/xkcp/support/Kernel-PMU/Kernel-pmu.md +133 -0
  271. data/ext/xkcp/support/Kernel-PMU/Makefile +8 -0
  272. data/ext/xkcp/support/Kernel-PMU/enable_arm_pmu.c +129 -0
  273. data/ext/xkcp/support/Kernel-PMU/load-module +1 -0
  274. data/ext/xkcp/util/KeccakSum/KeccakSum.c +394 -0
  275. data/ext/xkcp/util/KeccakSum/base64.c +86 -0
  276. data/ext/xkcp/util/KeccakSum/base64.h +12 -0
  277. data/lib/sleeping_kangaroo12/binding.rb +15 -0
  278. data/lib/sleeping_kangaroo12/build/loader.rb +40 -0
  279. data/lib/sleeping_kangaroo12/build/platform.rb +37 -0
  280. data/lib/sleeping_kangaroo12/build.rb +4 -0
  281. data/lib/sleeping_kangaroo12/digest.rb +103 -0
  282. data/lib/sleeping_kangaroo12/version.rb +5 -0
  283. data/lib/sleeping_kangaroo12.rb +7 -0
  284. metadata +372 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: e4aacaa549cb9d7beeef6977f03383868f29fb143cb35820a02fdbb8fa408ab1
4
+ data.tar.gz: e8c27359938bac4abebe69f71de89b4dcfad1880263c5f701af519e9c6a59741
5
+ SHA512:
6
+ metadata.gz: e857ff9f05810ffb2f3ec55ef881f839563c7fe856f973075295b4ecd2cfa14ff864d32aaaadf4142a0fbea5fbef353077ef3a0cf8c58414bbed1eb81caee445
7
+ data.tar.gz: 7fa8d7a961a56d25aedd0371e75db9c24874c1812bafc43495084171762d93cc21ae3435fe68ce0f2aaa6caa6f38afb512b1ec7cd276202c372c62e1e44a1e62
data/README.md ADDED
@@ -0,0 +1,127 @@
1
+ # SleepingKangaroo12
2
+
3
+ ## What is it?
4
+
5
+ SleepingKangaroo12 is a Ruby binding of [KangarooTwelve](https://keccak.team/kangarootwelve.html), a fast cryptographic
6
+ hash function by the team behind SHA-3.
7
+
8
+ ## Why not SHA-3?
9
+
10
+ SHA-3 is relatively slow without special function hardware, partly due to [NIST](https://www.nist.gov/), the organizer
11
+ of the SHA-3 competition, requested for a huge security margin from the candidates.
12
+
13
+ [The team behind Keccak](https://keccak.team/), the winner of the SHA-3 competition, feels that SHA-3 is not at the
14
+ sweet spot between trade-offs; they release a more performant, one-size-fit-all hash algorithm building on top of SHA-3
15
+ primitives, the KangarooTwelve.
16
+
17
+ Instead of making the function tunable like Keccak, they opinionatedly select the parameter for KangarooTwelve, so there
18
+ is one and only one KangarooTwelve variant.
19
+
20
+ ## Why Sleeping?
21
+
22
+ Other Ruby bindings existed before mine; I added the adjective to distinguish mine. Furthermore, I wrote this binding in
23
+ pajamas, and I don't expect that I'll have the need to update this gem. From your perspective, it might look as if the
24
+ gem is sleeping. :-D
25
+
26
+ ## What are specials?
27
+
28
+ Many!
29
+ Just take a peek at the code, you'll notice that:
30
+
31
+ - It builds on top of the [eXtended Keccak Code Package (XKCP)](https://github.com/XKCP/XKCP), an easy-to-use and highly
32
+ optimized library maintained by the Keccak team themselves.
33
+ - The binding auto-select and detects CPU features on installation, it supports `AVX512`, `AVX2`, and `SSSE3`
34
+ instruction sets out of the box. And able to run on a machine without special instruction sets.
35
+ - Thin and stable binding; designed by a proper software architect
36
+ - Not limited to [Matz's Ruby Interpreter (MRI)](https://en.wikipedia.org/wiki/Ruby_MRI), this is due to the gem opting
37
+ for [Ruby-FFI](https://github.com/ffi/ffi) instead of native extensions.
38
+ (I only tested on MRI, though.)
39
+ - Compared to other hash functions, this binding actually shipped with the optimized implementation. Some
40
+ other hash function might looks more performant on benchmarks, this may or may not translated to real-world
41
+ performance.
42
+
43
+ ## Prerequisites
44
+
45
+ In order to install the gem, your machine should be ready to build the XKCP package. Which mean you should prepare:
46
+
47
+ - GCC, the GNU Compiler Collection; our favorite
48
+ - GNU make
49
+ - xsltproc executable, normally comes with libxslt package
50
+ - And for the sake of completeness: Ruby, Bundler, and Ruby related stuffs
51
+
52
+ ## Installation
53
+
54
+ Add this line to your application's Gemfile:
55
+
56
+ ~~~ruby
57
+ gem 'sleeping_kangaroo12'
58
+ ~~~
59
+
60
+ And then execute:
61
+
62
+ $ bundle install
63
+
64
+ ## Usage Examples
65
+
66
+ Test vectors stolen
67
+ from [konsolebox/digest-kangarootwelve-ruby](https://github.com/konsolebox/digest-kangarootwelve-ruby), another Ruby
68
+ binding.
69
+
70
+ ~~~ruby
71
+ # Shortcuts
72
+ #
73
+ ::SleepingKangaroo12::Digest.digest('abc')
74
+ # Output: "\xAB\x17O2\x8CU\xA5Q\v\v \x97\x91\xBF\x8B`\xE8\x01\xA7\xCF\xC2\xAAB\x04-\xCB\x8FT\x7F\xBE:}"
75
+ #
76
+ ::SleepingKangaroo12::Digest.hexdigest('abc')
77
+ # Output: "ab174f328c55a5510b0b209791bf8b60e801a7cfc2aa42042dcb8f547fbe3a7d"
78
+
79
+ # Multiple updates
80
+ #
81
+ digest = ::SleepingKangaroo12::Digest.new
82
+ digest.update('a')
83
+ digest.update('b')
84
+ digest.update('c')
85
+ digest.hexdigest
86
+ # Output: "ab174f328c55a5510b0b209791bf8b60e801a7cfc2aa42042dcb8f547fbe3a7d"
87
+
88
+ # Hashing with a key, similar to HMAC
89
+ # KangarooTwelve call the key "customization", it is the same thing, FYI
90
+ #
91
+ digest = ::SleepingKangaroo12::Digest.new(key: 'secret')
92
+ digest << 'abc' # alternate form of update method
93
+ digest.hexdigest
94
+ # Output: "dc1fd53f85402e2b34fa92bd87593dd9c3fe6cc49d9db6c05dc0cf26c6a7e03f"
95
+ # HMAC requires 2 parses of hashing, the customization is definitely faster
96
+
97
+ # You can control the output length too
98
+ #
99
+ digest = ::SleepingKangaroo12::Digest.new(key: 'secret', output_length: 5)
100
+ digest << 'abc'
101
+ digest.hexdigest
102
+ # Output: "dc1fd53f85"
103
+ # This is marginally faster than truncating the output yourself.
104
+ #
105
+ digest = ::SleepingKangaroo12::Digest.new(key: 'secret', output_length: 64)
106
+ digest << 'abc'
107
+ digest.hexdigest
108
+ # Output: "dc1fd53f85402e2b34fa92bd87593dd9c3fe6cc49d9db6c05dc0cf26c6a7e03fc4b18c621b57dbb8967094b160dbf22ee42402d7e3d45ecab4b02ef0db14b105"
109
+ # The output is longer now, but the security claim is still the same.
110
+ # (as 256-bit output length, which translated to the security level of 128-bit)
111
+
112
+ # Weird parameters
113
+ #
114
+ digest = ::SleepingKangaroo12::Digest.new(key: 'secret', output_length: 1_000_000_000_000)
115
+ # This will error; I arbitrary set the limit at 1MiB - 1 bytes as a safety measure. Same for length <= 0
116
+ # If you have a use case for something out of range, feel free to discuss.
117
+ # You are probably looking for a stream cipher instead of a hash function, though.
118
+
119
+ # The options work with shortcuts too
120
+ #
121
+ ::SleepingKangaroo12::Digest.hexdigest('abc', key: 'secret')
122
+ # Output: "dc1fd53f85402e2b34fa92bd87593dd9c3fe6cc49d9db6c05dc0cf26c6a7e03f"
123
+ ~~~
124
+
125
+ ## License
126
+
127
+ SleepingKangaroo12 is released under the [BSD 3-Clause License](LICENSE.md). :tada:
data/ext/Rakefile ADDED
@@ -0,0 +1,73 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'fileutils'
4
+ require 'posix-spawn'
5
+ require 'set'
6
+ require_relative '../lib/sleeping_kangaroo12/build'
7
+
8
+ platform = ::SleepingKangaroo12::Build::Platform.instance
9
+ out_dir = "#{platform.arch}-#{platform.os}"
10
+ lib_name = ::File.join(out_dir, platform.map_library_name('SleepingKangaroo12'))
11
+
12
+ feature_set = ::POSIX::Spawn::Child.new('gcc -march=native -dM -E - < /dev/null').then(&:out).then do |output|
13
+ output.lines.select do |line|
14
+ line.include?('AVX') || line.include?('SSE') || line.include?('64')
15
+ end
16
+ end.each_with_object(::Set.new) do |line, accumulator|
17
+ matched = /(\S+)\s+1\s*\z/.match(line)
18
+ next unless matched
19
+ accumulator << matched[1]
20
+ end
21
+
22
+ static_target = if feature_set.include?('__AVX512F__') && feature_set.include?('__AVX512VL__')
23
+ 'libK12-avx512.a'
24
+ elsif feature_set.include?('__AVX2__') && feature_set.include?('__SSSE3__')
25
+ 'libK12-avx2-ssse3.a'
26
+ elsif feature_set.include?('__AVX2__')
27
+ 'libK12-avx2.a'
28
+ elsif feature_set.include?('__LP64__') && feature_set.include?('__SSSE3__')
29
+ 'libK12-ssse3-64.a'
30
+ elsif feature_set.include?('__LP64__')
31
+ 'libK12-generic-64.a'
32
+ elsif feature_set.include?('__SSSE3__')
33
+ 'libK12-ssse3.a'
34
+ else
35
+ 'libK12-generic.a'
36
+ end
37
+
38
+ xkcp_static_target = "xkcp/bin/#{static_target}"
39
+
40
+ task default: [lib_name]
41
+
42
+ file lib_name => FileList['bin/.build/sleeping_kangaroo12.o', xkcp_static_target] do |t|
43
+ ::FileUtils.mkdir_p(::File.dirname(t.name))
44
+ static_lib = t.prerequisites.last
45
+ static_lib_dir = ::File.dirname(static_lib)
46
+ static_lib_file = ::File.basename(static_lib)
47
+ sh "gcc -shared -o #{t.name} #{t.prerequisites.first} -L#{static_lib_dir} -l:#{static_lib_file} -lm -lc"
48
+ end
49
+
50
+ file 'bin/.build/sleeping_kangaroo12.o' => FileList['binding/sleeping_kangaroo12.c', xkcp_static_target] do |t|
51
+ sh "gcc -Wall -Wa,-adhln -O3 -march=native -I./xkcp/bin -c #{t.prerequisites.first} -o #{t.name}"
52
+ end
53
+
54
+ file xkcp_static_target => FileList['bin/.build/Makefile'] do |t|
55
+ file_name = ::File.basename(t.name)
56
+ sh "cd xkcp && make -f ../#{t.prerequisites.first} #{file_name}"
57
+ end
58
+
59
+ desc 'Generate XKCP\'s Makefile'
60
+ file 'bin/.build/Makefile' => FileList['bin/.build/Makefile.expanded'] do |t|
61
+ ::FileUtils.mkdir_p(::File.dirname(t.name))
62
+ sh "cd xkcp && xsltproc --xinclude -o ../#{t.name} support/Build/ToGlobalMakefile.xsl ../#{t.prerequisites.last}"
63
+ # rewrite Makefile path
64
+ original_make = ::File.read(t.name)
65
+ modified_make = original_make.gsub(%r{(\s+)(bin/.build/Makefile)}, '\1../\2')
66
+ ::File.write(t.name, modified_make, mode: 'wb')
67
+ end
68
+
69
+ desc 'Expand XKCP\'s Makefile'
70
+ file 'bin/.build/Makefile.expanded' => FileList['config/xkcp.build'] do |t|
71
+ ::FileUtils.mkdir_p(::File.dirname(t.name))
72
+ sh "cd xkcp && xsltproc --xinclude -o ../#{t.name} support/Build/ExpandProducts.xsl ../#{t.prerequisites.last}"
73
+ end
@@ -0,0 +1,39 @@
1
+ #if defined(__AVX512F__) && defined(__AVX512VL__)
2
+ #include "libK12-avx512.a.headers/KangarooTwelve.h"
3
+ #elif defined(__AVX2__) && defined(__SSSE3__)
4
+ #include "libK12-avx2-ssse3.a.headers/KangarooTwelve.h"
5
+ #elif defined(__AVX2__)
6
+ #include "libK12-avx2.a.headers/KangarooTwelve.h"
7
+ #elif defined(__LP64__) && defined(__SSSE3__)
8
+ #include "libK12-ssse3-64.a.headers/KangarooTwelve.h"
9
+ #elif defined(__LP64__)
10
+ #include "libK12-generic-64.a.headers/KangarooTwelve.h"
11
+ #elif defined(__SSSE3__)
12
+ #include "libK12-ssse3.a.headers/KangarooTwelve.h"
13
+ #else
14
+ #include "libK12-generic.a.headers/KangarooTwelve.h"
15
+ #endif
16
+
17
+ #include <stdlib.h>
18
+
19
+ void * SleepingKangaroo12_Init(int outputLength) {
20
+ KangarooTwelve_Instance *retVal = malloc(sizeof (KangarooTwelve_Instance)); // TODO: check result
21
+ KangarooTwelve_Initialize(retVal, outputLength); // TODO: check result
22
+ return retVal;
23
+ }
24
+
25
+ int SleepingKangaroo12_Update(void *instance, const unsigned char *input, size_t inputByteLen) {
26
+ return KangarooTwelve_Update((KangarooTwelve_Instance *)instance, input, inputByteLen);
27
+ }
28
+
29
+ int SleepingKangaroo12_Final(void *instance, unsigned char *output, const unsigned char *customization, size_t customByteLen) {
30
+ return KangarooTwelve_Final((KangarooTwelve_Instance *)instance, output, customization, customByteLen);
31
+ }
32
+
33
+ int SleepingKangaroo12_Squeeze(void *instance, unsigned char *output, size_t customByteLen) {
34
+ return KangarooTwelve_Squeeze((KangarooTwelve_Instance *)instance, output, customByteLen);
35
+ }
36
+
37
+ void SleepingKangaroo12_Destroy(void *instance) {
38
+ free(instance);
39
+ }
@@ -0,0 +1,17 @@
1
+ <build all="all" xmlns:xi="http://www.w3.org/2001/XInclude">
2
+ <xi:include href="../xkcp/lib/HighLevel.build"/>
3
+ <xi:include href="../xkcp/lib/LowLevel.build"/>
4
+
5
+ <fragment name="common">
6
+ <h>../xkcp/lib/common/align.h</h>
7
+ <h>../xkcp/lib/common/brg_endian.h</h>
8
+ </fragment>
9
+
10
+ <target name="libK12-generic.a" inherits="KangarooTwelve K1600-compact"/>
11
+ <target name="libK12-generic-64.a" inherits="KangarooTwelve K1600-plain-64bits-u6"/>
12
+ <target name="libK12-ssse3.a" inherits="KangarooTwelve K1600-compact K1600x2-SSSE3-u2"/>
13
+ <target name="libK12-ssse3-64.a" inherits="KangarooTwelve K1600-plain-64bits-u6 K1600x2-SSSE3-u2"/>
14
+ <target name="libK12-avx2.a" inherits="KangarooTwelve K1600-AVX2 K1600x4-AVX2-u12"/>
15
+ <target name="libK12-avx2-ssse3.a" inherits="KangarooTwelve K1600-AVX2 K1600x2-SSSE3-u2 K1600x4-AVX2-u12"/>
16
+ <target name="libK12-avx512.a" inherits="KangarooTwelve K1600-AVX512 K1600x2-AVX512-u12 K1600x4-AVX512-u12 K1600x8-AVX512-u12"/>
17
+ </build>
data/ext/xkcp/LICENSE ADDED
@@ -0,0 +1 @@
1
+ See in file README.markdown, after the line starting with "# Under which license is the KCP distributed?".
data/ext/xkcp/Makefile ADDED
@@ -0,0 +1,15 @@
1
+ _list: Makefile.build support/Build/ToGlobalMakefile.xsl
2
+
3
+ bin/.build/Makefile: bin/.build/Makefile.expanded
4
+ mkdir -p $(dir $@)
5
+ xsltproc --xinclude -o $@ support/Build/ToGlobalMakefile.xsl $<
6
+
7
+ bin/.build/Makefile.expanded: Makefile.build
8
+ mkdir -p $(dir $@)
9
+ xsltproc --xinclude -o $@ support/Build/ExpandProducts.xsl $<
10
+
11
+ -include bin/.build/Makefile
12
+
13
+ .PHONY: clean
14
+ clean:
15
+ rm -rf bin/
@@ -0,0 +1,200 @@
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ The eXtended Keccak Code Package (XKCP)
4
+ https://github.com/XKCP/XKCP
5
+
6
+ Implementation by Gilles Van Assche and Ronny Van Keer, hereby denoted as "the implementer".
7
+
8
+ For more information, feedback or questions, please refer to the Keccak Team website:
9
+ https://keccak.team/
10
+
11
+ To the extent possible under law, the implementer has waived all copyright
12
+ and related or neighboring rights to the source code in this file.
13
+ http://creativecommons.org/publicdomain/zero/1.0/
14
+ -->
15
+ <build all="all" xmlns:xi="http://www.w3.org/2001/XInclude">
16
+
17
+ <xi:include href="lib/HighLevel.build"/>
18
+ <xi:include href="lib/LowLevel.build"/>
19
+ <xi:include href="tests/SUPERCOP/SUPERCOP.build"/>
20
+ <xi:include href="tests/NIST_LWC/NIST_LWC.build"/>
21
+ <xi:include href="doc/HOWTO-customize.build"/>
22
+
23
+ <!-- For the name of the targets, please see the end of this file. -->
24
+
25
+ <fragment name="common">
26
+ <h>lib/common/align.h</h>
27
+ <h>lib/common/brg_endian.h</h>
28
+ </fragment>
29
+
30
+ <!-- *** Utilities *** -->
31
+
32
+ <!-- The unit tests -->
33
+ <fragment name="UT" inherits="common">
34
+ <c>tests/UnitTests/main.c</c>
35
+ <c>tests/UnitTests/UT.c</c>
36
+ <h>tests/UnitTests/UT.h</h>
37
+ <c>tests/UnitTests/testPermutations.c</c>
38
+ <h>tests/UnitTests/testPermutations.h</h>
39
+ <inc>tests/UnitTests/testSnP.inc</inc>
40
+ <inc>tests/UnitTests/testPlSnP.inc</inc>
41
+ <c>tests/UnitTests/testSponge.c</c>
42
+ <inc>tests/UnitTests/testSponge.inc</inc>
43
+ <h>tests/UnitTests/testSponge.h</h>
44
+ <c>tests/UnitTests/testDuplex.c</c>
45
+ <inc>tests/UnitTests/testDuplex.inc</inc>
46
+ <h>tests/UnitTests/testDuplex.h</h>
47
+ <c>tests/UnitTests/testMotorist.c</c>
48
+ <inc>tests/UnitTests/testMotorist.inc</inc>
49
+ <h>tests/UnitTests/testMotorist.h</h>
50
+ <c>tests/UnitTests/testKeyakv2.c</c>
51
+ <inc>tests/UnitTests/testKeyakv2.inc</inc>
52
+ <h>tests/UnitTests/testKeyakv2.h</h>
53
+ <c>tests/UnitTests/testKetjev2.c</c>
54
+ <h>tests/UnitTests/testKetjev2.h</h>
55
+ <inc>tests/UnitTests/testKetjev2.inc</inc>
56
+ <c>tests/UnitTests/genKAT.c</c>
57
+ <h>tests/UnitTests/genKAT.h</h>
58
+ <c>tests/UnitTests/testPRG.c</c>
59
+ <inc>tests/UnitTests/testPRG.inc</inc>
60
+ <h>tests/UnitTests/testPRG.h</h>
61
+ <c>tests/UnitTests/testKangarooTwelve.c</c>
62
+ <h>tests/UnitTests/testKangarooTwelve.h</h>
63
+ <c>tests/UnitTests/testKravatte.c</c>
64
+ <h>tests/UnitTests/testKravatte.h</h>
65
+ <c>tests/UnitTests/testKravatteModes.c</c>
66
+ <h>tests/UnitTests/testKravatteModes.h</h>
67
+ <c>tests/UnitTests/testSP800-185.c</c>
68
+ <h>tests/UnitTests/testSP800-185.h</h>
69
+ <c>tests/UnitTests/testXoofff.c</c>
70
+ <h>tests/UnitTests/testXoofff.h</h>
71
+ <c>tests/UnitTests/testXoofffModes.c</c>
72
+ <h>tests/UnitTests/testXoofffModes.h</h>
73
+ <c>tests/UnitTests/testXoodyak.c</c>
74
+ <h>tests/UnitTests/testXoodyak.h</h>
75
+ </fragment>
76
+
77
+ <fragment name="UnitTests" inherits="All UT"/>
78
+
79
+
80
+ <!-- The benchmarking tool -->
81
+
82
+ <fragment name="BM" inherits="common">
83
+ <c>tests/Benchmarks/main.c</c>
84
+ <c>tests/Benchmarks/testPerformance.c</c>
85
+ <c>tests/Benchmarks/timing.c</c>
86
+ <h>tests/Benchmarks/timing.h</h>
87
+ <h>tests/Benchmarks/testPerformance.h</h>
88
+ <inc>tests/Benchmarks/timingSnP.inc</inc>
89
+ <inc>tests/Benchmarks/timingPlSnP.inc</inc>
90
+ <inc>tests/Benchmarks/timingSponge.inc</inc>
91
+ <inc>tests/Benchmarks/timingKeyak.inc</inc>
92
+ <c>tests/Benchmarks/testXooPerformance.c</c>
93
+ <h>tests/Benchmarks/testXooPerformance.h</h>
94
+ <inc>tests/Benchmarks/timingXooSnP.inc</inc>
95
+ <inc>tests/Benchmarks/timingXooPlSnP.inc</inc>
96
+ <gcc>-lm</gcc>
97
+ </fragment>
98
+
99
+ <fragment name="Benchmarks" inherits="All BM"/>
100
+
101
+ <!-- To compute a hash of a file -->
102
+ <fragment name="KeccakSum" inherits="FIPS202 SP800-185 KangarooTwelve">
103
+ <c>util/KeccakSum/KeccakSum.c</c>
104
+ <c>util/KeccakSum/base64.c</c>
105
+ <h>util/KeccakSum/base64.h</h>
106
+ </fragment>
107
+
108
+ <!-- To make a library -->
109
+ <fragment name="libXKCP.a" inherits="All"/>
110
+ <fragment name="libXKCP.so" inherits="All"/>
111
+
112
+ <!-- *** CAESAR-related targets *** -->
113
+
114
+ <fragment name="crypto_aead_test">
115
+ <h>tests/SUPERCOP/test_crypto_aead.h</h>
116
+ <c>tests/SUPERCOP/test_crypto_aead.c</c>
117
+ </fragment>
118
+
119
+ <!-- *** Targets *** -->
120
+
121
+ <fragment name="serial-fallbacks" inherits="K1600x2-on1 K1600x4-on1 K1600x8-on1 Xoodoox4-on1 Xoodoox8-on1 Xoodoox16-on1"/>
122
+
123
+ <!-- Reference implementations -->
124
+ <fragment name="reference" inherits="K200-ref K400-ref K800-ref K1600-ref-64bits serial-fallbacks Ket-SnP Xoodoo-ref">
125
+ <c>tests/UnitTests/displayIntermediateValues.c</c>
126
+ <h>tests/UnitTests/displayIntermediateValues.h</h>
127
+ <define>KeccakReference</define>
128
+ <gcc>-O</gcc>
129
+ </fragment>
130
+
131
+ <!-- Reference implementations dedicated to 32-bit platforms
132
+ (i.e., featuring bit interleaving for Keccak-p[1600]) -->
133
+ <fragment name="reference32bits" inherits="K200-ref K400-ref K800-ref K1600-ref-32bits serial-fallbacks Ket-SnP Xoodoo-ref">
134
+ <c>tests/UnitTests/displayIntermediateValues.c</c>
135
+ <h>tests/UnitTests/displayIntermediateValues.h</h>
136
+ <define>KeccakReference</define>
137
+ <define>KeccakReference32BI</define>
138
+ <gcc>-O</gcc>
139
+ </fragment>
140
+
141
+ <!-- Compact implementations -->
142
+ <fragment name="compact" inherits="K200-compact K400-ref K800-compact K1600-compact serial-fallbacks Ket-SnP Xoodoo-plain-ua"/>
143
+
144
+ <!-- Generically optimized 32-bit implementations -->
145
+ <fragment name="generic32" inherits="K200-ref K400-ref K800-plain-u2 K1600-plain-32bits-inplace serial-fallbacks Ket-SnP Xoodoo-plain-ua"/>
146
+ <!-- Generically optimized 32-bit implementations, featuring lane complementing -->
147
+ <fragment name="generic32lc" inherits="K200-ref K400-ref K800-plain-lcu2 K1600-plain-32bits-inplace serial-fallbacks Ket-SnP Xoodoo-plain-ua"/>
148
+
149
+ <!-- Generically optimized 64-bit implementations -->
150
+ <fragment name="generic64" inherits="K200-ref K400-ref K800-plain-ua K1600-plain-64bits-ua serial-fallbacks Ket-SnP Xoodoo-plain-ua"/>
151
+ <!-- Generically optimized 64-bit implementations, featuring lane complementing -->
152
+ <fragment name="generic64lc" inherits="K200-ref K400-ref K800-plain-lcua K1600-plain-64bits-lcua serial-fallbacks Ket-SnP Xoodoo-plain-ua"/>
153
+
154
+ <!-- Implementations selected for the processors that support the SSSE3 instruction set -->
155
+ <fragment name="SSSE3" inherits="K200-ref K400-ref K800-plain-lcua K1600-plain-64bits-lcua K1600x2-SSSE3-u2 K1600x4-on2 K1600x8-on2 Ket-SnP Xoodoo-SSE2 Xoodoox4-SSSE3 Xoodoox8-on1 Xoodoox16-on1"/>
156
+
157
+ <!-- Implementations selected for processors that support the AVX instruction set (e.g., Sandy Bridge microarchitectures) -->
158
+ <fragment name="AVX" inherits="K200-ref K400-ref K800-plain-lcua K1600-plain-64bits-lcua-shld K1600x2-SSSE3-ua K1600x4-on2 K1600x8-on2 Ket-SnP Xoodoo-SSE2 Xoodoox4-SSSE3 Xoodoox8-on1 Xoodoox16-on1">
159
+ <msvc>/arch:AVX</msvc>
160
+ </fragment>
161
+ <!-- Implementations selected for processors that support the XOP instruction set (e.g., Bulldozer microarchitecture) -->
162
+ <fragment name="XOP" inherits="K200-ref K400-ref K800-plain-lcua K1600-XOP-ua K1600x2-XOP-ua K1600x4-on2 K1600x8-on2 Ket-SnP Xoodoo-SSE2 Xoodoox4-SSSE3 Xoodoox8-on1 Xoodoox16-on1"/>
163
+ <!-- Implementations selected for processors that support the AVX2 instruction set (e.g., Haswell and Skylake microarchitectures) -->
164
+ <fragment name="AVX2" inherits="K200-ref K400-ref K800-plain-ua K1600-AVX2 K1600x2-SSSE3-u2 K1600x4-AVX2-u12 K1600x8-on4 Ket-SnP Xoodoo-SSE2 Xoodoox4-SSSE3 Xoodoox8-AVX2 Xoodoox16-on1"/>
165
+ <!-- Same, but without the assembly file (for MS Visual Studio) -->
166
+ <fragment name="AVX2noAsm" inherits="K200-ref K400-ref K800-plain-ua K1600-plain-64bits-ua K1600x2-SSSE3-u2 K1600x4-AVX2-u12 K1600x8-on4 Ket-SnP Xoodoo-SSE2 Xoodoox4-SSSE3 Xoodoox8-AVX2 Xoodoox16-on1">
167
+ <msvc>/arch:AVX2</msvc>
168
+ </fragment>
169
+
170
+ <!-- Implementations selected for the processors that support the AVX-512 instruction set (e.g., SkylakeX microarchitecture) -->
171
+ <fragment name="AVX512" inherits="K200-ref K400-ref K800-plain-ua K1600-AVX512 K1600x2-AVX512-u12 K1600x4-AVX512-u12 K1600x8-AVX512-u12 Ket-SnP Xoodoo-AVX512 Xoodoox4-AVX512 Xoodoox8-AVX512 Xoodoox16-AVX512"/>
172
+ <!-- Same, but without the assembly file (for MS Visual Studio) -->
173
+ <fragment name="AVX512noAsm" inherits="K200-ref K400-ref K800-plain-ua K1600-AVX512-C K1600x2-AVX512-u12 K1600x4-AVX512-u12 K1600x8-AVX512-u12 Ket-SnP Xoodoo-AVX512 Xoodoox4-AVX512 Xoodoox8-AVX512 Xoodoox16-AVX512">
174
+ <msvc>/arch:AVX512</msvc>
175
+ </fragment>
176
+
177
+ <!-- Implementations selected for ARMv6 -->
178
+ <fragment name="ARMv6" inherits="K200-ARMv6M K400-ARMv6M K800-ARMv6M-u2 K1600-ARMv6M-u2 serial-fallbacks Ket-SnP Xoodoo-ARMv6"/>
179
+ <!-- Implementations selected for ARMv6M -->
180
+ <fragment name="ARMv6M" inherits="K200-ARMv6M K400-ARMv6M K800-ARMv6M-u2 K1600-ARMv6M-u2 serial-fallbacks Ket-SnP Xoodoo-ARMv6M"/>
181
+ <!-- Implementations selected for ARMv7M -->
182
+ <fragment name="ARMv7M" inherits="K200-ARMv7M K400-ARMv7M K800-ARMv7M-u2 K1600-ARMv7M-inplace serial-fallbacks Ket-ARMv7M Xoodoo-ARMv7M"/>
183
+ <!-- Implementations selected for ARMv7A -->
184
+ <fragment name="ARMv7A" inherits="K200-ref K400-ref K800-ARMv7A-u2 K1600-ARMv7A-NEON K1600x2-ARMv7A-NEON K1600x4-on2 K1600x8-on2 Ket-optimizedLE Xoodoo-ARMv7A-NEON Xoodoox4-ARMv7A-NEON Xoodoox8-on1 Xoodoox16-on1"/>
185
+
186
+ <!-- Implementations selected for ARMv8A -->
187
+ <fragment name="ARMv8A" inherits="K200-ref K400-ref K800-plain-ua K1600-plain-64bits-ua serial-fallbacks Ket-optimizedLE Xoodoo-plain-ua"/>
188
+
189
+ <!-- Implementations selected for 8-bit AVR -->
190
+ <fragment name="AVR8" inherits="K200-AVR8 K400-AVR8 K800-AVR8 K1600-AVR8 serial-fallbacks Ket-SnP Xoodoo-AVR8"/>
191
+
192
+ <!-- Target names are of the form x/y where x is taken from the first set and y from the second set. -->
193
+ <group all="XKCP">
194
+ <product delimiter="/">
195
+ <factor set="reference reference32bits compact generic32 generic32lc generic64 generic64lc SSSE3 AVX XOP AVX2 AVX2noAsm AVX512 AVX512noAsm ARMv6 ARMv6M ARMv7M ARMv7A ARMv8A AVR8"/>
196
+ <factor set="UnitTests Benchmarks KeccakSum libXKCP.a libXKCP.so libXKCP.dylib"/>
197
+ </product>
198
+ </group>
199
+
200
+ </build>