sha3-ruby 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (186) hide show
  1. data/.gitignore +17 -0
  2. data/Gemfile +4 -0
  3. data/LICENSE.txt +22 -0
  4. data/README.md +29 -0
  5. data/Rakefile +7 -0
  6. data/ext/sha3/KeccakReferenceAndOptimized/KeccakCompact.vcproj +207 -0
  7. data/ext/sha3/KeccakReferenceAndOptimized/KeccakCompact8.vcproj +207 -0
  8. data/ext/sha3/KeccakReferenceAndOptimized/KeccakInplace.vcproj +203 -0
  9. data/ext/sha3/KeccakReferenceAndOptimized/KeccakInplace32BI.vcproj +201 -0
  10. data/ext/sha3/KeccakReferenceAndOptimized/KeccakOptimized32.vcproj +267 -0
  11. data/ext/sha3/KeccakReferenceAndOptimized/KeccakOptimized64.vcproj +267 -0
  12. data/ext/sha3/KeccakReferenceAndOptimized/KeccakReference.vcproj +243 -0
  13. data/ext/sha3/KeccakReferenceAndOptimized/KeccakReference32BI.vcproj +243 -0
  14. data/ext/sha3/KeccakReferenceAndOptimized/KeccakReferenceAndOptimized.sln +62 -0
  15. data/ext/sha3/KeccakReferenceAndOptimized/KeccakSimple.vcproj +203 -0
  16. data/ext/sha3/KeccakReferenceAndOptimized/KeccakSimple32BI.vcproj +201 -0
  17. data/ext/sha3/KeccakReferenceAndOptimized/Sources/AVR8-rotate64.h +27 -0
  18. data/ext/sha3/KeccakReferenceAndOptimized/Sources/AVR8-rotate64.s +285 -0
  19. data/ext/sha3/KeccakReferenceAndOptimized/Sources/Keccak-avr8-settings.h +2 -0
  20. data/ext/sha3/KeccakReferenceAndOptimized/Sources/Keccak-avr8-test.c +142 -0
  21. data/ext/sha3/KeccakReferenceAndOptimized/Sources/Keccak-avr8-util.h +15 -0
  22. data/ext/sha3/KeccakReferenceAndOptimized/Sources/Keccak-avr8-util.s +119 -0
  23. data/ext/sha3/KeccakReferenceAndOptimized/Sources/Keccak-avr8.c +184 -0
  24. data/ext/sha3/KeccakReferenceAndOptimized/Sources/Keccak-avr8.h +25 -0
  25. data/ext/sha3/KeccakReferenceAndOptimized/Sources/Keccak-compact-settings.h +3 -0
  26. data/ext/sha3/KeccakReferenceAndOptimized/Sources/Keccak-compact-test.c +317 -0
  27. data/ext/sha3/KeccakReferenceAndOptimized/Sources/Keccak-compact.c +341 -0
  28. data/ext/sha3/KeccakReferenceAndOptimized/Sources/Keccak-compact.h +50 -0
  29. data/ext/sha3/KeccakReferenceAndOptimized/Sources/Keccak-compact8-settings.h +2 -0
  30. data/ext/sha3/KeccakReferenceAndOptimized/Sources/Keccak-compact8-test.c +192 -0
  31. data/ext/sha3/KeccakReferenceAndOptimized/Sources/Keccak-compact8.c +375 -0
  32. data/ext/sha3/KeccakReferenceAndOptimized/Sources/Keccak-compact8.h +47 -0
  33. data/ext/sha3/KeccakReferenceAndOptimized/Sources/Keccak-crypto_hash-inplace-armgcc-ARMv7A-NEON.s +406 -0
  34. data/ext/sha3/KeccakReferenceAndOptimized/Sources/Keccak-inplace-minimal-test.c +231 -0
  35. data/ext/sha3/KeccakReferenceAndOptimized/Sources/Keccak-inplace-settings.h +3 -0
  36. data/ext/sha3/KeccakReferenceAndOptimized/Sources/Keccak-inplace-test.c +221 -0
  37. data/ext/sha3/KeccakReferenceAndOptimized/Sources/Keccak-inplace.c +445 -0
  38. data/ext/sha3/KeccakReferenceAndOptimized/Sources/Keccak-inplace32BI-armgcc-ARMv6M.s +844 -0
  39. data/ext/sha3/KeccakReferenceAndOptimized/Sources/Keccak-inplace32BI-armgcc-ARMv7A.s +687 -0
  40. data/ext/sha3/KeccakReferenceAndOptimized/Sources/Keccak-inplace32BI-armgcc-ARMv7M.s +687 -0
  41. data/ext/sha3/KeccakReferenceAndOptimized/Sources/Keccak-inplace32BI.c +849 -0
  42. data/ext/sha3/KeccakReferenceAndOptimized/Sources/Keccak-simple-settings.h +3 -0
  43. data/ext/sha3/KeccakReferenceAndOptimized/Sources/Keccak-simple-test.c +221 -0
  44. data/ext/sha3/KeccakReferenceAndOptimized/Sources/Keccak-simple.c +403 -0
  45. data/ext/sha3/KeccakReferenceAndOptimized/Sources/Keccak-simple32BI.c +673 -0
  46. data/ext/sha3/KeccakReferenceAndOptimized/Sources/KeccakDuplex.c +68 -0
  47. data/ext/sha3/KeccakReferenceAndOptimized/Sources/KeccakDuplex.h +59 -0
  48. data/ext/sha3/KeccakReferenceAndOptimized/Sources/KeccakF-1600-32-rvk.macros +555 -0
  49. data/ext/sha3/KeccakReferenceAndOptimized/Sources/KeccakF-1600-32-s1.macros +1187 -0
  50. data/ext/sha3/KeccakReferenceAndOptimized/Sources/KeccakF-1600-32-s2.macros +1187 -0
  51. data/ext/sha3/KeccakReferenceAndOptimized/Sources/KeccakF-1600-32.macros +26 -0
  52. data/ext/sha3/KeccakReferenceAndOptimized/Sources/KeccakF-1600-64.macros +728 -0
  53. data/ext/sha3/KeccakReferenceAndOptimized/Sources/KeccakF-1600-arm.c +123 -0
  54. data/ext/sha3/KeccakReferenceAndOptimized/Sources/KeccakF-1600-armcc.s +653 -0
  55. data/ext/sha3/KeccakReferenceAndOptimized/Sources/KeccakF-1600-armgcc.s +686 -0
  56. data/ext/sha3/KeccakReferenceAndOptimized/Sources/KeccakF-1600-avr8.c +163 -0
  57. data/ext/sha3/KeccakReferenceAndOptimized/Sources/KeccakF-1600-avr8asm-compact.s +647 -0
  58. data/ext/sha3/KeccakReferenceAndOptimized/Sources/KeccakF-1600-avr8asm-fast.s +934 -0
  59. data/ext/sha3/KeccakReferenceAndOptimized/Sources/KeccakF-1600-inplace-armgcc-ARMv7A-NEON.s +446 -0
  60. data/ext/sha3/KeccakReferenceAndOptimized/Sources/KeccakF-1600-int-set.h +6 -0
  61. data/ext/sha3/KeccakReferenceAndOptimized/Sources/KeccakF-1600-interface.h +46 -0
  62. data/ext/sha3/KeccakReferenceAndOptimized/Sources/KeccakF-1600-opt32-settings.h +4 -0
  63. data/ext/sha3/KeccakReferenceAndOptimized/Sources/KeccakF-1600-opt32.c +524 -0
  64. data/ext/sha3/KeccakReferenceAndOptimized/Sources/KeccakF-1600-opt64-settings.h +7 -0
  65. data/ext/sha3/KeccakReferenceAndOptimized/Sources/KeccakF-1600-opt64.c +504 -0
  66. data/ext/sha3/KeccakReferenceAndOptimized/Sources/KeccakF-1600-reference.c +300 -0
  67. data/ext/sha3/KeccakReferenceAndOptimized/Sources/KeccakF-1600-reference.h +20 -0
  68. data/ext/sha3/KeccakReferenceAndOptimized/Sources/KeccakF-1600-reference.o +0 -0
  69. data/ext/sha3/KeccakReferenceAndOptimized/Sources/KeccakF-1600-reference32BI.c +371 -0
  70. data/ext/sha3/KeccakReferenceAndOptimized/Sources/KeccakF-1600-simd128.macros +651 -0
  71. data/ext/sha3/KeccakReferenceAndOptimized/Sources/KeccakF-1600-simd64.macros +517 -0
  72. data/ext/sha3/KeccakReferenceAndOptimized/Sources/KeccakF-1600-unrolling.macros +124 -0
  73. data/ext/sha3/KeccakReferenceAndOptimized/Sources/KeccakF-1600-x86-64-asm.c +62 -0
  74. data/ext/sha3/KeccakReferenceAndOptimized/Sources/KeccakF-1600-x86-64-gas.s +766 -0
  75. data/ext/sha3/KeccakReferenceAndOptimized/Sources/KeccakF-1600-x86-64-shld-gas.s +766 -0
  76. data/ext/sha3/KeccakReferenceAndOptimized/Sources/KeccakF-1600-xop.macros +573 -0
  77. data/ext/sha3/KeccakReferenceAndOptimized/Sources/KeccakNISTInterface.c +81 -0
  78. data/ext/sha3/KeccakReferenceAndOptimized/Sources/KeccakNISTInterface.h +70 -0
  79. data/ext/sha3/KeccakReferenceAndOptimized/Sources/KeccakNISTInterface.o +0 -0
  80. data/ext/sha3/KeccakReferenceAndOptimized/Sources/KeccakSponge.c +266 -0
  81. data/ext/sha3/KeccakReferenceAndOptimized/Sources/KeccakSponge.h +76 -0
  82. data/ext/sha3/KeccakReferenceAndOptimized/Sources/KeccakSponge.o +0 -0
  83. data/ext/sha3/KeccakReferenceAndOptimized/Sources/Keccakc1024-crypto_hash-inplace-armgcc-ARMv7A-NEON.s +296 -0
  84. data/ext/sha3/KeccakReferenceAndOptimized/Sources/Keccakc512-crypto_hash-inplace-armgcc-ARMv7A-NEON.s +429 -0
  85. data/ext/sha3/KeccakReferenceAndOptimized/Sources/brg_endian.h +142 -0
  86. data/ext/sha3/KeccakReferenceAndOptimized/Sources/crypto_hash.h +0 -0
  87. data/ext/sha3/KeccakReferenceAndOptimized/Sources/displayIntermediateValues.c +117 -0
  88. data/ext/sha3/KeccakReferenceAndOptimized/Sources/displayIntermediateValues.h +29 -0
  89. data/ext/sha3/KeccakReferenceAndOptimized/Sources/displayIntermediateValues.o +0 -0
  90. data/ext/sha3/KeccakReferenceAndOptimized/Sources/genKAT.c +692 -0
  91. data/ext/sha3/KeccakReferenceAndOptimized/Sources/mainARM.c +88 -0
  92. data/ext/sha3/KeccakReferenceAndOptimized/Sources/mainOptimized.c +23 -0
  93. data/ext/sha3/KeccakReferenceAndOptimized/Sources/mainReference.c +381 -0
  94. data/ext/sha3/KeccakReferenceAndOptimized/Sources/timing.c +436 -0
  95. data/ext/sha3/KeccakReferenceAndOptimized/Sources/timing.h +13 -0
  96. data/ext/sha3/KeccakReferenceAndOptimized/TreeHashing/Sources/DoublePermutation-config.h +2 -0
  97. data/ext/sha3/KeccakReferenceAndOptimized/TreeHashing/Sources/DoublePermutation.c +572 -0
  98. data/ext/sha3/KeccakReferenceAndOptimized/TreeHashing/Sources/DoublePermutation.h +38 -0
  99. data/ext/sha3/KeccakReferenceAndOptimized/TreeHashing/Sources/KeccakF-1600-unrolling.macros +124 -0
  100. data/ext/sha3/KeccakReferenceAndOptimized/TreeHashing/Sources/Keccakc256TreeD2.c +81 -0
  101. data/ext/sha3/KeccakReferenceAndOptimized/TreeHashing/Sources/Keccakc256TreeD2.h +18 -0
  102. data/ext/sha3/KeccakReferenceAndOptimized/TreeHashing/Sources/Keccakc512TreeD2.c +81 -0
  103. data/ext/sha3/KeccakReferenceAndOptimized/TreeHashing/Sources/Keccakc512TreeD2.h +18 -0
  104. data/ext/sha3/KeccakReferenceAndOptimized/TreeHashing/Sources/crypto_hash.h +0 -0
  105. data/ext/sha3/KeccakReferenceAndOptimized/TreeHashing/Sources/mainOptimized.c +112 -0
  106. data/ext/sha3/KeccakReferenceAndOptimized/TreeHashing/Sources/timing-Double.c +225 -0
  107. data/ext/sha3/KeccakReferenceAndOptimized/TreeHashing/Sources/timing-Double.h +20 -0
  108. data/ext/sha3/KeccakReferenceAndOptimized/TreeHashing/makefile +68 -0
  109. data/ext/sha3/KeccakReferenceAndOptimized/bin/KeccakCompact +0 -0
  110. data/ext/sha3/KeccakReferenceAndOptimized/bin/KeccakOptimized32 +0 -0
  111. data/ext/sha3/KeccakReferenceAndOptimized/bin/KeccakOptimized64 +0 -0
  112. data/ext/sha3/KeccakReferenceAndOptimized/bin/KeccakReference +0 -0
  113. data/ext/sha3/KeccakReferenceAndOptimized/bin/KeccakReference32BI +0 -0
  114. data/ext/sha3/KeccakReferenceAndOptimized/bin/KeccakSimple +0 -0
  115. data/ext/sha3/KeccakReferenceAndOptimized/bin/KeccakSimple32BI +0 -0
  116. data/ext/sha3/KeccakReferenceAndOptimized/bin/compact/Keccak-compact-test.o +0 -0
  117. data/ext/sha3/KeccakReferenceAndOptimized/bin/compact/Keccak-compact.o +0 -0
  118. data/ext/sha3/KeccakReferenceAndOptimized/bin/optimized32/KeccakDuplex.o +0 -0
  119. data/ext/sha3/KeccakReferenceAndOptimized/bin/optimized32/KeccakF-1600-opt32.o +0 -0
  120. data/ext/sha3/KeccakReferenceAndOptimized/bin/optimized32/KeccakNISTInterface.o +0 -0
  121. data/ext/sha3/KeccakReferenceAndOptimized/bin/optimized32/KeccakSponge.o +0 -0
  122. data/ext/sha3/KeccakReferenceAndOptimized/bin/optimized32/genKAT.o +0 -0
  123. data/ext/sha3/KeccakReferenceAndOptimized/bin/optimized32/mainOptimized.o +0 -0
  124. data/ext/sha3/KeccakReferenceAndOptimized/bin/optimized32/timing.o +0 -0
  125. data/ext/sha3/KeccakReferenceAndOptimized/bin/optimized64/KeccakDuplex.o +0 -0
  126. data/ext/sha3/KeccakReferenceAndOptimized/bin/optimized64/KeccakF-1600-opt64.o +0 -0
  127. data/ext/sha3/KeccakReferenceAndOptimized/bin/optimized64/KeccakNISTInterface.o +0 -0
  128. data/ext/sha3/KeccakReferenceAndOptimized/bin/optimized64/KeccakSponge.o +0 -0
  129. data/ext/sha3/KeccakReferenceAndOptimized/bin/optimized64/genKAT.o +0 -0
  130. data/ext/sha3/KeccakReferenceAndOptimized/bin/optimized64/mainOptimized.o +0 -0
  131. data/ext/sha3/KeccakReferenceAndOptimized/bin/optimized64/timing.o +0 -0
  132. data/ext/sha3/KeccakReferenceAndOptimized/bin/reference/KeccakDuplex.o +0 -0
  133. data/ext/sha3/KeccakReferenceAndOptimized/bin/reference/KeccakF-1600-reference.o +0 -0
  134. data/ext/sha3/KeccakReferenceAndOptimized/bin/reference/KeccakNISTInterface.o +0 -0
  135. data/ext/sha3/KeccakReferenceAndOptimized/bin/reference/KeccakSponge.o +0 -0
  136. data/ext/sha3/KeccakReferenceAndOptimized/bin/reference/displayIntermediateValues.o +0 -0
  137. data/ext/sha3/KeccakReferenceAndOptimized/bin/reference/genKAT.o +0 -0
  138. data/ext/sha3/KeccakReferenceAndOptimized/bin/reference/mainReference.o +0 -0
  139. data/ext/sha3/KeccakReferenceAndOptimized/bin/reference32bi/KeccakDuplex.o +0 -0
  140. data/ext/sha3/KeccakReferenceAndOptimized/bin/reference32bi/KeccakF-1600-reference32BI.o +0 -0
  141. data/ext/sha3/KeccakReferenceAndOptimized/bin/reference32bi/KeccakNISTInterface.o +0 -0
  142. data/ext/sha3/KeccakReferenceAndOptimized/bin/reference32bi/KeccakSponge.o +0 -0
  143. data/ext/sha3/KeccakReferenceAndOptimized/bin/reference32bi/displayIntermediateValues.o +0 -0
  144. data/ext/sha3/KeccakReferenceAndOptimized/bin/reference32bi/genKAT.o +0 -0
  145. data/ext/sha3/KeccakReferenceAndOptimized/bin/reference32bi/mainReference.o +0 -0
  146. data/ext/sha3/KeccakReferenceAndOptimized/bin/simple/Keccak-simple-test.o +0 -0
  147. data/ext/sha3/KeccakReferenceAndOptimized/bin/simple/Keccak-simple.o +0 -0
  148. data/ext/sha3/KeccakReferenceAndOptimized/bin/simple32BI/Keccak-simple-test.o +0 -0
  149. data/ext/sha3/KeccakReferenceAndOptimized/bin/simple32BI/Keccak-simple32BI.o +0 -0
  150. data/ext/sha3/KeccakReferenceAndOptimized/compile64.bat +1 -0
  151. data/ext/sha3/KeccakReferenceAndOptimized/eBASH/checksum-keccak +1 -0
  152. data/ext/sha3/KeccakReferenceAndOptimized/eBASH/checksum-keccakc1024 +1 -0
  153. data/ext/sha3/KeccakReferenceAndOptimized/eBASH/checksum-keccakc256 +1 -0
  154. data/ext/sha3/KeccakReferenceAndOptimized/eBASH/checksum-keccakc256treed2 +1 -0
  155. data/ext/sha3/KeccakReferenceAndOptimized/eBASH/checksum-keccakc448 +1 -0
  156. data/ext/sha3/KeccakReferenceAndOptimized/eBASH/checksum-keccakc512 +1 -0
  157. data/ext/sha3/KeccakReferenceAndOptimized/eBASH/checksum-keccakc512treed2 +1 -0
  158. data/ext/sha3/KeccakReferenceAndOptimized/eBASH/checksum-keccakc768 +1 -0
  159. data/ext/sha3/KeccakReferenceAndOptimized/eBASH/hash-keccak.c +11 -0
  160. data/ext/sha3/KeccakReferenceAndOptimized/eBASH/hash-keccakc1024.c +11 -0
  161. data/ext/sha3/KeccakReferenceAndOptimized/eBASH/hash-keccakc256.c +11 -0
  162. data/ext/sha3/KeccakReferenceAndOptimized/eBASH/hash-keccakc448.c +11 -0
  163. data/ext/sha3/KeccakReferenceAndOptimized/eBASH/hash-keccakc512.c +11 -0
  164. data/ext/sha3/KeccakReferenceAndOptimized/eBASH/hash-keccakc768.c +11 -0
  165. data/ext/sha3/KeccakReferenceAndOptimized/eBASH/int-set-keccak.h +1 -0
  166. data/ext/sha3/KeccakReferenceAndOptimized/eBASH/int-set-keccakc1024.h +1 -0
  167. data/ext/sha3/KeccakReferenceAndOptimized/eBASH/int-set-keccakc256.h +1 -0
  168. data/ext/sha3/KeccakReferenceAndOptimized/eBASH/int-set-keccakc448.h +1 -0
  169. data/ext/sha3/KeccakReferenceAndOptimized/eBASH/int-set-keccakc512.h +1 -0
  170. data/ext/sha3/KeccakReferenceAndOptimized/eBASH/int-set-keccakc768.h +1 -0
  171. data/ext/sha3/KeccakReferenceAndOptimized/eBASH/populate.py +506 -0
  172. data/ext/sha3/KeccakReferenceAndOptimized/eBASH/simple-keccak.h +2 -0
  173. data/ext/sha3/KeccakReferenceAndOptimized/eBASH/simple-keccakc1024.h +2 -0
  174. data/ext/sha3/KeccakReferenceAndOptimized/eBASH/simple-keccakc256.h +2 -0
  175. data/ext/sha3/KeccakReferenceAndOptimized/eBASH/simple-keccakc448.h +2 -0
  176. data/ext/sha3/KeccakReferenceAndOptimized/eBASH/simple-keccakc512.h +2 -0
  177. data/ext/sha3/KeccakReferenceAndOptimized/eBASH/simple-keccakc768.h +2 -0
  178. data/ext/sha3/KeccakReferenceAndOptimized/makefile +327 -0
  179. data/ext/sha3/Makefile +240 -0
  180. data/ext/sha3/depend +28 -0
  181. data/ext/sha3/extconf.rb +21 -0
  182. data/ext/sha3/sha3.c +95 -0
  183. data/lib/sha3-ruby.rb +27 -0
  184. data/lib/sha3-ruby/version.rb +5 -0
  185. data/sha3-ruby.gemspec +21 -0
  186. metadata +233 -0
@@ -0,0 +1,123 @@
1
+ /*
2
+ The Keccak sponge function, designed by Guido Bertoni, Joan Daemen,
3
+ Michaël Peeters and Gilles Van Assche. For more information, feedback or
4
+ questions, please refer to our website: http://keccak.noekeon.org/
5
+
6
+ Implementation by Ronny Van Keer,
7
+ hereby denoted as "the implementer".
8
+
9
+ To the extent possible under law, the implementer has waived all copyright
10
+ and related or neighboring rights to the source code in this file.
11
+ http://creativecommons.org/publicdomain/zero/1.0/
12
+ */
13
+
14
+ #include "KeccakF-1600-interface.h"
15
+ #include "KeccakSponge.h"
16
+ #include <string.h>
17
+
18
+ typedef unsigned char UINT8;
19
+ typedef unsigned short UINT16;
20
+ typedef unsigned int UINT32;
21
+ typedef unsigned long long int UINT64;
22
+
23
+ void KeccakPermutationOnWordsAfterXoring_ARM_asm(UINT32 *state, const UINT8 *input, int laneCount);
24
+
25
+ void KeccakInitialize( void )
26
+ {
27
+ }
28
+
29
+ void KeccakInitializeState(unsigned char *state)
30
+ {
31
+ memset(state, 0, KeccakPermutationSizeInBytes);
32
+ }
33
+
34
+ void KeccakPermutation(unsigned char *state)
35
+ {
36
+ KeccakPermutationOnWordsAfterXoring_ARM_asm((UINT32*)state, 0, 0);
37
+ }
38
+
39
+ #ifdef ProvideFast576
40
+ void KeccakAbsorb576bits(unsigned char *state, const unsigned char *data)
41
+ {
42
+ KeccakPermutationOnWordsAfterXoring_ARM_asm((UINT32*)state, data, 9);
43
+ }
44
+ #endif
45
+
46
+ #ifdef ProvideFast832
47
+ void KeccakAbsorb832bits(unsigned char *state, const unsigned char *data)
48
+ {
49
+ KeccakPermutationOnWordsAfterXoring_ARM_asm((UINT32*)state, data, 13);
50
+ }
51
+ #endif
52
+
53
+ #ifdef ProvideFast1024
54
+ void KeccakAbsorb1024bits(unsigned char *state, const unsigned char *data)
55
+ {
56
+ KeccakPermutationOnWordsAfterXoring_ARM_asm((UINT32*)state, data, 16);
57
+ }
58
+ #endif
59
+
60
+ #ifdef ProvideFast1088
61
+ void KeccakAbsorb1088bits(unsigned char *state, const unsigned char *data)
62
+ {
63
+ KeccakPermutationOnWordsAfterXoring_ARM_asm((UINT32*)state, data, 17);
64
+ }
65
+ #endif
66
+
67
+ #ifdef ProvideFast1152
68
+ void KeccakAbsorb1152bits(unsigned char *state, const unsigned char *data)
69
+ {
70
+ KeccakPermutationOnWordsAfterXoring_ARM_asm((UINT32*)state, data, 18);
71
+ }
72
+ #endif
73
+
74
+ #ifdef ProvideFast1344
75
+ void KeccakAbsorb1344bits(unsigned char *state, const unsigned char *data)
76
+ {
77
+ KeccakPermutationOnWordsAfterXoring_ARM_asm((UINT32*)state, data, 21);
78
+ }
79
+ #endif
80
+
81
+
82
+ void KeccakAbsorb(unsigned char *state, const unsigned char *data, unsigned int laneCount)
83
+ {
84
+ KeccakPermutationOnWordsAfterXoring_ARM_asm((UINT32*)state, data, laneCount);
85
+ }
86
+
87
+ // Credit: Henry S. Warren, Hacker's Delight, Addison-Wesley, 2002
88
+ UINT64 fromInterleaving(UINT64 x)
89
+ {
90
+ UINT64 t;
91
+
92
+ t = (x ^ (x >> 16)) & 0x00000000FFFF0000ULL; x = x ^ t ^ (t << 16);
93
+ t = (x ^ (x >> 8)) & 0x0000FF000000FF00ULL; x = x ^ t ^ (t << 8);
94
+ t = (x ^ (x >> 4)) & 0x00F000F000F000F0ULL; x = x ^ t ^ (t << 4);
95
+ t = (x ^ (x >> 2)) & 0x0C0C0C0C0C0C0C0CULL; x = x ^ t ^ (t << 2);
96
+ t = (x ^ (x >> 1)) & 0x2222222222222222ULL; x = x ^ t ^ (t << 1);
97
+
98
+ return x;
99
+ }
100
+
101
+ void setInterleavedWordsInto8bytes(UINT8* dest, UINT32* evenAndOdd)
102
+ {
103
+ ((UINT64*)dest)[0] = fromInterleaving(*(UINT64*)evenAndOdd);
104
+ }
105
+
106
+ #define extractLanes(laneCount, state, data) \
107
+ { \
108
+ int i; \
109
+ for(i=0; i<(laneCount); i++) \
110
+ setInterleavedWordsInto8bytes(data+i*8, (UINT32*)state+i*2); \
111
+ }
112
+
113
+ #ifdef ProvideFast1024
114
+ void KeccakExtract1024bits(const unsigned char *state, unsigned char *data)
115
+ {
116
+ extractLanes(16, state, data)
117
+ }
118
+ #endif
119
+
120
+ void KeccakExtract(const unsigned char *state, unsigned char *data, unsigned int laneCount)
121
+ {
122
+ extractLanes(laneCount, state, data)
123
+ }
@@ -0,0 +1,653 @@
1
+ ;// The Keccak sponge function, designed by Guido Bertoni, Joan Daemen,
2
+ ;// Michaël Peeters and Gilles Van Assche. For more information, feedback or
3
+ ;// questions, please refer to our website: http://keccak.noekeon.org/
4
+ ;//
5
+ ;// Implementation by Ronny Van Keer,
6
+ ;// hereby denoted as "the implementer".
7
+ ;//
8
+ ;// To the extent possible under law, the implementer has waived all copyright
9
+ ;// and related or neighboring rights to the source code in this file.
10
+ ;// http://creativecommons.org/publicdomain/zero/1.0/
11
+
12
+
13
+ PRESERVE8
14
+ THUMB
15
+ AREA |.text|, CODE, READONLY
16
+
17
+ ;// --- defines
18
+
19
+ _ba0 equ 0*4
20
+ _ba1 equ 1*4
21
+ _be0 equ 2*4
22
+ _be1 equ 3*4
23
+ _bi0 equ 4*4
24
+ _bi1 equ 5*4
25
+ _bo0 equ 6*4
26
+ _bo1 equ 7*4
27
+ _bu0 equ 8*4
28
+ _bu1 equ 9*4
29
+ _ga0 equ 10*4
30
+ _ga1 equ 11*4
31
+ _ge0 equ 12*4
32
+ _ge1 equ 13*4
33
+ _gi0 equ 14*4
34
+ _gi1 equ 15*4
35
+ _go0 equ 16*4
36
+ _go1 equ 17*4
37
+ _gu0 equ 18*4
38
+ _gu1 equ 19*4
39
+ _ka0 equ 20*4
40
+ _ka1 equ 21*4
41
+ _ke0 equ 22*4
42
+ _ke1 equ 23*4
43
+ _ki0 equ 24*4
44
+ _ki1 equ 25*4
45
+ _ko0 equ 26*4
46
+ _ko1 equ 27*4
47
+ _ku0 equ 28*4
48
+ _ku1 equ 29*4
49
+ _ma0 equ 30*4
50
+ _ma1 equ 31*4
51
+ _me0 equ 32*4
52
+ _me1 equ 33*4
53
+ _mi0 equ 34*4
54
+ _mi1 equ 35*4
55
+ _mo0 equ 36*4
56
+ _mo1 equ 37*4
57
+ _mu0 equ 38*4
58
+ _mu1 equ 39*4
59
+ _sa0 equ 40*4
60
+ _sa1 equ 41*4
61
+ _se0 equ 42*4
62
+ _se1 equ 43*4
63
+ _si0 equ 44*4
64
+ _si1 equ 45*4
65
+ _so0 equ 46*4
66
+ _so1 equ 47*4
67
+ _su0 equ 48*4
68
+ _su1 equ 49*4
69
+
70
+ mDe1 equ 50*4
71
+ mDi0 equ 51*4
72
+ mDo0 equ 52*4
73
+ mDo1 equ 53*4
74
+
75
+ ;// --- macros
76
+
77
+ MACRO
78
+ xor5 $result,$ptr,$b,$g,$k,$m,$s
79
+
80
+ ldr $result, [$ptr, #$b]
81
+ ldr r1, [$ptr, #$g]
82
+ ldr r2, [$ptr, #$k]
83
+ eor $result, $result, r1
84
+ ldr r1, [$ptr, #$m]
85
+ eor $result, $result, r2
86
+ ldr r2, [$ptr, #$s]
87
+ eor $result, $result, r1
88
+ eor $result, $result, r2
89
+ MEND
90
+
91
+ MACRO
92
+ xorrol $b, $yy, $rr
93
+
94
+ eor $b, $b, $yy
95
+ ror $b, #32-$rr
96
+ MEND
97
+
98
+
99
+ MACRO
100
+ xandnot $resptr, $resofs, $aa, $bb, $cc
101
+
102
+ bic r1, $cc, $bb
103
+ eor r1, r1, $aa
104
+ str r1, [$resptr, #$resofs]
105
+ MEND
106
+
107
+ MACRO
108
+ xandnotRC $resptr, $resofs, $aa, $bb, $cc
109
+
110
+ ldr r1, [r3], #4
111
+ bic $cc, $cc, $bb
112
+ eor $cc, $cc, r1
113
+ eor $cc, $cc, $aa
114
+ str $cc, [$resptr, #$resofs]
115
+ MEND
116
+
117
+
118
+ EXPORT KeccakPermutationOnWordsAfterXoring_ARM_asm
119
+ KeccakPermutationOnWordsAfterXoring_ARM_asm PROC
120
+
121
+ push {r4-r12,lr}
122
+ sub sp,sp,#4*(50+4)
123
+
124
+ movs r9, r2
125
+ beq interleaveDone
126
+ mov r8,r0
127
+ interleaveLoop
128
+
129
+ ldr r4, [r1], #4
130
+ ldr r5, [r1], #4
131
+ ldrd r6, r7, [r8]
132
+
133
+ ;// Credit: Henry S. Warren, Hacker's Delight, Addison-Wesley, 2002
134
+ and r3,r4,#0x55555555
135
+ orr r3,r3,r3, LSR #1
136
+ and r3,r3,#0x33333333
137
+ orr r3,r3,r3, LSR #2
138
+ and r3,r3,#0x0F0F0F0F
139
+ orr r3,r3,r3, LSR #4
140
+ and r3,r3,#0x00FF00FF
141
+ bfi r3,r3,#8, #8
142
+ eor r6,r6,r3, LSR #8
143
+
144
+ and r3,r5,#0x55555555
145
+ orr r3,r3,r3, LSR #1
146
+ and r3,r3,#0x33333333
147
+ orr r3,r3,r3, LSR #2
148
+ and r3,r3,#0x0F0F0F0F
149
+ orr r3,r3,r3, LSR #4
150
+ and r3,r3,#0x00FF00FF
151
+ orr r3,r3,r3, LSR #8
152
+ eor r6,r6,r3, LSL #16
153
+
154
+ and r3,r4,#0xAAAAAAAA
155
+ orr r3,r3,r3, LSL #1
156
+ and r3,r3,#0xCCCCCCCC
157
+ orr r3,r3,r3, LSL #2
158
+ and r3,r3,#0xF0F0F0F0
159
+ orr r3,r3,r3, LSL #4
160
+ and r3,r3,#0xFF00FF00
161
+ orr r3,r3,r3, LSL #8
162
+ eor r7,r7,r3, LSR #16
163
+
164
+ and r3,r5,#0xAAAAAAAA
165
+ orr r3,r3,r3, LSL #1
166
+ and r3,r3,#0xCCCCCCCC
167
+ orr r3,r3,r3, LSL #2
168
+ and r3,r3,#0xF0F0F0F0
169
+ orr r3,r3,r3, LSL #4
170
+ and r3,r3,#0xFF00FF00
171
+ orr r3,r3,r3, LSL #8
172
+ bfc r3, #0, #16
173
+ eor r7,r7,r3
174
+
175
+ strd r6,r7,[r8], #8
176
+
177
+ subs r9,r9,#1
178
+ bne interleaveLoop
179
+
180
+ interleaveDone
181
+
182
+ ldr r3, =KeccakF1600RoundConstantsWithTerminator
183
+ b roundLoop ;//jump over the table
184
+ LTORG
185
+
186
+ ALIGN
187
+
188
+ KeccakF1600RoundConstantsWithTerminator
189
+ ;// 0 1
190
+ dcd 0x00000001, 0x00000000
191
+ dcd 0x00000000, 0x00000089
192
+ dcd 0x00000000, 0x8000008b
193
+ dcd 0x00000000, 0x80008080
194
+ dcd 0x00000001, 0x0000008b
195
+ dcd 0x00000001, 0x00008000
196
+ dcd 0x00000001, 0x80008088
197
+ dcd 0x00000001, 0x80000082
198
+ dcd 0x00000000, 0x0000000b
199
+ dcd 0x00000000, 0x0000000a
200
+ dcd 0x00000001, 0x00008082
201
+ dcd 0x00000000, 0x00008003
202
+ dcd 0x00000001, 0x0000808b
203
+ dcd 0x00000001, 0x8000000b
204
+ dcd 0x00000001, 0x8000008a
205
+ dcd 0x00000001, 0x80000081
206
+ dcd 0x00000000, 0x80000081
207
+ dcd 0x00000000, 0x80000008
208
+ dcd 0x00000000, 0x00000083
209
+ dcd 0x00000000, 0x80008003
210
+ dcd 0x00000001, 0x80008088
211
+ dcd 0x00000000, 0x80000088
212
+ dcd 0x00000001, 0x00008000
213
+ dcd 0x00000000, 0x80008082
214
+ dcd 0xFFFFFFFF ;//terminator
215
+
216
+ roundLoop
217
+
218
+ ;//prepTheta A
219
+ xor5 r10, r0,_bu0, _gu0, _ku0, _mu0, _su0
220
+ xor5 r6, r0,_be1, _ge1, _ke1, _me1, _se1
221
+ eor r5, r10, r6, ROR #31
222
+ xor5 r11, r0,_bu1, _gu1, _ku1, _mu1, _su1
223
+ xor5 r7, r0,_be0, _ge0, _ke0, _me0, _se0
224
+ eor r4, r11, r7
225
+
226
+ xor5 r8, r0,_bi0, _gi0, _ki0, _mi0, _si0
227
+ eor r1, r8, r11, ROR #31
228
+ str r1, [sp, #mDo0]
229
+ xor5 r9, r0,_bi1, _gi1, _ki1, _mi1, _si1
230
+ eor r1, r9, r10
231
+ str r1, [sp, #mDo1]
232
+
233
+ xor5 r10, r0,_ba0, _ga0, _ka0, _ma0, _sa0
234
+ eor lr, r10, r9, ROR #31
235
+ xor5 r11, r0,_ba1, _ga1, _ka1, _ma1, _sa1
236
+ eor r1, r11, r8
237
+ str r1, [sp, #mDe1]
238
+
239
+ xor5 r9, r0,_bo1, _go1, _ko1, _mo1, _so1
240
+ eor r1, r7, r9, ROR #31
241
+ str r1, [sp, #mDi0]
242
+ xor5 r8, r0,_bo0, _go0, _ko0, _mo0, _so0
243
+ eor r2, r6, r8
244
+
245
+ eor r7, r8, r11, ROR #31
246
+ eor r6, r9, r10
247
+
248
+ ;//thetaRhoPiChiIota 0, in A, out E
249
+ ldr r8, [r0, #_ba0]
250
+ ldr r9, [r0, #_ge0]
251
+ ldr r10, [r0, #_ki1]
252
+ ldr r11, [r0, #_mo1]
253
+ ldr r12, [r0, #_su0]
254
+ ldr r1, [sp, #mDo1]
255
+ eor r8, r8, r5
256
+ xorrol r9, lr, 22
257
+ xorrol r10, r2, 22
258
+ xorrol r11, r1, 11
259
+ xorrol r12, r7, 7
260
+ xandnot sp, _be0, r9, r10, r11
261
+ xandnot sp, _bi0, r10, r11, r12
262
+ xandnot sp, _bo0, r11, r12, r8
263
+ xandnot sp, _bu0, r12, r8, r9
264
+ xandnotRC sp, _ba0, r8, r9, r10
265
+
266
+ ldr r8, [r0, #_bo0]
267
+ ldr r1, [sp, #mDo0]
268
+ ldr r9, [r0, #_gu0]
269
+ xorrol r8, r1, 14
270
+ ldr r1, [sp, #mDe1]
271
+ ldr r10, [r0, #_ka1]
272
+ ldr r11, [r0, #_me1]
273
+ ldr r12, [r0, #_si1]
274
+ xorrol r9, r7, 10
275
+ xorrol r10, r4, 2
276
+ xorrol r11, r1, 23
277
+ xorrol r12, r2, 31
278
+ xandnot sp, _ga0, r8, r9, r10
279
+ xandnot sp, _ge0, r9, r10, r11
280
+ xandnot sp, _gi0, r10, r11, r12
281
+ xandnot sp, _go0, r11, r12, r8
282
+ xandnot sp, _gu0, r12, r8, r9
283
+
284
+ ldr r8, [r0, #_be1]
285
+ ldr r1, [sp, #mDe1]
286
+ ldr r9, [r0, #_gi0]
287
+ xorrol r8, r1, 1
288
+ ldr r1, [sp, #mDi0]
289
+ ldr r10, [r0, #_ko1]
290
+ xorrol r9, r1, 3
291
+ ldr r1, [sp, #mDo1]
292
+ ldr r11, [r0, #_mu0]
293
+ ldr r12, [r0, #_sa0]
294
+ xorrol r10, r1, 13
295
+ xorrol r11, r7, 4
296
+ xorrol r12, r5, 9
297
+ xandnot sp, _ka0, r8, r9, r10
298
+ xandnot sp, _ke0, r9, r10, r11
299
+ xandnot sp, _ki0, r10, r11, r12
300
+ xandnot sp, _ko0, r11, r12, r8
301
+ xandnot sp, _ku0, r12, r8, r9
302
+
303
+ ldr r8, [r0, #_bu1]
304
+ ldr r9, [r0, #_ga0]
305
+ ldr r10, [r0, #_ke0]
306
+ ldr r11, [r0, #_mi1]
307
+ ldr r12, [r0, #_so0]
308
+ ldr r1, [sp, #mDo0]
309
+ xorrol r8, r6, 14
310
+ xorrol r9, r5, 18
311
+ xorrol r10, lr, 5
312
+ xorrol r11, r2, 8
313
+ xorrol r12, r1, 28
314
+ xandnot sp, _ma0, r8, r9, r10
315
+ xandnot sp, _me0, r9, r10, r11
316
+ xandnot sp, _mi0, r10, r11, r12
317
+ xandnot sp, _mo0, r11, r12, r8
318
+ xandnot sp, _mu0, r12, r8, r9
319
+
320
+ ldr r1, [sp, #mDi0]
321
+ ldr r8, [r0, #_bi0]
322
+ ldr r9, [r0, #_go1]
323
+ xorrol r8, r1, 31
324
+ ldr r1, [sp, #mDo1]
325
+ ldr r10, [r0, #_ku1]
326
+ xorrol r9, r1, 28
327
+ ldr r11, [r0, #_ma1]
328
+ ldr r12, [r0, #_se0]
329
+ xorrol r10, r6, 20
330
+ xorrol r11, r4, 21
331
+ xorrol r12, lr, 1
332
+ xandnot sp, _sa0, r8, r9, r10
333
+ xandnot sp, _se0, r9, r10, r11
334
+ xandnot sp, _si0, r10, r11, r12
335
+ xandnot sp, _so0, r11, r12, r8
336
+ xandnot sp, _su0, r12, r8, r9
337
+
338
+ ;// thetaRhoPiChiIota 1, in A, out E
339
+ ldr r1, [sp, #mDe1]
340
+ ldr r9, [r0, #_ge1]
341
+ ldr r8, [r0, #_ba1]
342
+ xorrol r9, r1, 22
343
+ ldr r1, [sp, #mDi0]
344
+ ldr r10, [r0, #_ki0]
345
+ eor r8, r8, r4
346
+ xorrol r10, r1, 21
347
+ ldr r1, [sp, #mDo0]
348
+ ldr r11, [r0, #_mo0]
349
+ ldr r12, [r0, #_su1]
350
+ xorrol r11, r1, 10
351
+ xorrol r12, r6, 7
352
+ xandnot sp, _be1, r9, r10, r11
353
+ xandnot sp, _bi1, r10, r11, r12
354
+ xandnot sp, _bo1, r11, r12, r8
355
+ xandnot sp, _bu1, r12, r8, r9
356
+ xandnotRC sp, _ba1, r8, r9, r10
357
+
358
+ ldr r1, [sp, #mDo1]
359
+ ldr r8, [r0, #_bo1]
360
+ ldr r12, [r0, #_si0]
361
+ xorrol r8, r1, 14
362
+ ldr r1, [sp, #mDi0]
363
+ ldr r9, [r0, #_gu1]
364
+ xorrol r12, r1, 30
365
+ ldr r10, [r0, #_ka0]
366
+ ldr r11, [r0, #_me0]
367
+ xorrol r9, r6, 10
368
+ xorrol r10, r5, 1
369
+ xorrol r11, lr, 22
370
+ xandnot sp, _ga1, r8, r9, r10
371
+ xandnot sp, _ge1, r9, r10, r11
372
+ xandnot sp, _gi1, r10, r11, r12
373
+ xandnot sp, _go1, r11, r12, r8
374
+ xandnot sp, _gu1, r12, r8, r9
375
+
376
+ ldr r1, [sp, #mDo0]
377
+ ldr r10, [r0, #_ko0]
378
+ ldr r8, [r0, #_be0]
379
+ xorrol r10, r1, 12
380
+ ldr r9, [r0, #_gi1]
381
+ ldr r11, [r0, #_mu1]
382
+ ldr r12, [r0, #_sa1]
383
+ eor r8, r8, lr
384
+ xorrol r9, r2, 3
385
+ xorrol r11, r6, 4
386
+ xorrol r12, r4, 9
387
+ xandnot sp, _ka1, r8, r9, r10
388
+ xandnot sp, _ke1, r9, r10, r11
389
+ xandnot sp, _ki1, r10, r11, r12
390
+ xandnot sp, _ko1, r11, r12, r8
391
+ xandnot sp, _ku1, r12, r8, r9
392
+
393
+ ldr r1, [sp, #mDe1]
394
+ ldr r10, [r0, #_ke1]
395
+ ldr r11, [r0, #_mi0]
396
+ xorrol r10, r1, 5
397
+ ldr r1, [sp, #mDi0]
398
+ ldr r12, [r0, #_so1]
399
+ xorrol r11, r1, 7
400
+ ldr r1, [sp, #mDo1]
401
+ ldr r8, [r0, #_bu0]
402
+ ldr r9, [r0, #_ga1]
403
+ xorrol r8, r7, 13
404
+ xorrol r9, r4, 18
405
+ xorrol r12, r1, 28
406
+ xandnot sp, _ma1, r8, r9, r10
407
+ xandnot sp, _me1, r9, r10, r11
408
+ xandnot sp, _mi1, r10, r11, r12
409
+ xandnot sp, _mo1, r11, r12, r8
410
+ xandnot sp, _mu1, r12, r8, r9
411
+
412
+ ldr r1, [sp, #mDo0]
413
+ ldr r9, [r0, #_go0]
414
+ ldr r8, [r0, #_bi1]
415
+ xorrol r9, r1, 27
416
+ ldr r10, [r0, #_ku0]
417
+ ldr r11, [r0, #_ma0]
418
+ ldr r12, [r0, #_se1]
419
+ ldr r1, [sp, #mDe1]
420
+ xorrol r8, r2, 31
421
+ xorrol r10, r7, 19
422
+ xorrol r11, r5, 20
423
+ xorrol r12, r1, 1
424
+ xandnot sp, _sa1, r8, r9, r10
425
+ xandnot sp, _se1, r9, r10, r11
426
+ xandnot sp, _si1, r10, r11, r12
427
+ xandnot sp, _so1, r11, r12, r8
428
+ xandnot sp, _su1, r12, r8, r9
429
+
430
+ ;//prepTheta E
431
+ xor5 r10, sp,_bu0, _gu0, _ku0, _mu0, _su0
432
+ xor5 r6, sp,_be1, _ge1, _ke1, _me1, _se1
433
+ eor r5, r10, r6, ROR #31
434
+ xor5 r11, sp,_bu1, _gu1, _ku1, _mu1, _su1
435
+ xor5 r7, sp,_be0, _ge0, _ke0, _me0, _se0
436
+ eor r4, r11, r7
437
+
438
+ xor5 r8, sp,_bi0, _gi0, _ki0, _mi0, _si0
439
+ eor r1, r8, r11, ROR #31
440
+ str r1, [sp, #mDo0]
441
+ xor5 r9, sp,_bi1, _gi1, _ki1, _mi1, _si1
442
+ eor r1, r9, r10
443
+ str r1, [sp, #mDo1]
444
+
445
+ xor5 r10, sp,_ba0, _ga0, _ka0, _ma0, _sa0
446
+ eor lr, r10, r9, ROR #31
447
+ xor5 r11, sp,_ba1, _ga1, _ka1, _ma1, _sa1
448
+ eor r1, r11, r8
449
+ str r1, [sp, #mDe1]
450
+
451
+ xor5 r9, sp,_bo1, _go1, _ko1, _mo1, _so1
452
+ eor r1, r7, r9, ROR #31
453
+ str r1, [sp, #mDi0]
454
+ xor5 r8, sp,_bo0, _go0, _ko0, _mo0, _so0
455
+ eor r2, r6, r8
456
+
457
+ eor r7, r8, r11, ROR #31
458
+ eor r6, r9, r10
459
+
460
+ ;//thetaRhoPiChiIota 0, in E, out A
461
+ ldr r8, [sp, #_ba0]
462
+ ldr r9, [sp, #_ge0]
463
+ ldr r10, [sp, #_ki1]
464
+ ldr r11, [sp, #_mo1]
465
+ ldr r12, [sp, #_su0]
466
+ ldr r1, [sp, #mDo1]
467
+ eor r8, r8, r5
468
+ xorrol r9, lr, 22
469
+ xorrol r10, r2, 22
470
+ xorrol r11, r1, 11
471
+ xorrol r12, r7, 7
472
+ xandnot r0, _be0, r9, r10, r11
473
+ xandnot r0, _bi0, r10, r11, r12
474
+ xandnot r0, _bo0, r11, r12, r8
475
+ xandnot r0, _bu0, r12, r8, r9
476
+ xandnotRC r0, _ba0, r8, r9, r10
477
+
478
+ ldr r8, [sp, #_bo0]
479
+ ldr r1, [sp, #mDo0]
480
+ ldr r9, [sp, #_gu0]
481
+ xorrol r8, r1, 14
482
+ ldr r1, [sp, #mDe1]
483
+ ldr r10, [sp, #_ka1]
484
+ ldr r11, [sp, #_me1]
485
+ ldr r12, [sp, #_si1]
486
+ xorrol r9, r7, 10
487
+ xorrol r10, r4, 2
488
+ xorrol r11, r1, 23
489
+ xorrol r12, r2, 31
490
+ xandnot r0, _ga0, r8, r9, r10
491
+ xandnot r0, _ge0, r9, r10, r11
492
+ xandnot r0, _gi0, r10, r11, r12
493
+ xandnot r0, _go0, r11, r12, r8
494
+ xandnot r0, _gu0, r12, r8, r9
495
+
496
+ ldr r8, [sp, #_be1]
497
+ ldr r1, [sp, #mDe1]
498
+ ldr r9, [sp, #_gi0]
499
+ xorrol r8, r1, 1
500
+ ldr r1, [sp, #mDi0]
501
+ ldr r10, [sp, #_ko1]
502
+ xorrol r9, r1, 3
503
+ ldr r1, [sp, #mDo1]
504
+ ldr r11, [sp, #_mu0]
505
+ ldr r12, [sp, #_sa0]
506
+ xorrol r10, r1, 13
507
+ xorrol r11, r7, 4
508
+ xorrol r12, r5, 9
509
+ xandnot r0, _ka0, r8, r9, r10
510
+ xandnot r0, _ke0, r9, r10, r11
511
+ xandnot r0, _ki0, r10, r11, r12
512
+ xandnot r0, _ko0, r11, r12, r8
513
+ xandnot r0, _ku0, r12, r8, r9
514
+
515
+ ldr r8, [sp, #_bu1]
516
+ ldr r9, [sp, #_ga0]
517
+ ldr r10, [sp, #_ke0]
518
+ ldr r11, [sp, #_mi1]
519
+ ldr r12, [sp, #_so0]
520
+ ldr r1, [sp, #mDo0]
521
+ xorrol r8, r6, 14
522
+ xorrol r9, r5, 18
523
+ xorrol r10, lr, 5
524
+ xorrol r11, r2, 8
525
+ xorrol r12, r1, 28
526
+ xandnot r0, _ma0, r8, r9, r10
527
+ xandnot r0, _me0, r9, r10, r11
528
+ xandnot r0, _mi0, r10, r11, r12
529
+ xandnot r0, _mo0, r11, r12, r8
530
+ xandnot r0, _mu0, r12, r8, r9
531
+
532
+ ldr r1, [sp, #mDi0]
533
+ ldr r8, [sp, #_bi0]
534
+ ldr r9, [sp, #_go1]
535
+ xorrol r8, r1, 31
536
+ ldr r1, [sp, #mDo1]
537
+ ldr r10, [sp, #_ku1]
538
+ xorrol r9, r1, 28
539
+ ldr r11, [sp, #_ma1]
540
+ ldr r12, [sp, #_se0]
541
+ xorrol r10, r6, 20
542
+ xorrol r11, r4, 21
543
+ xorrol r12, lr, 1
544
+ xandnot r0, _sa0, r8, r9, r10
545
+ xandnot r0, _se0, r9, r10, r11
546
+ xandnot r0, _si0, r10, r11, r12
547
+ xandnot r0, _so0, r11, r12, r8
548
+ xandnot r0, _su0, r12, r8, r9
549
+
550
+ ;// thetaRhoPiChiIota 1, in A, out E
551
+ ldr r1, [sp, #mDe1]
552
+ ldr r9, [sp, #_ge1]
553
+ ldr r8, [sp, #_ba1]
554
+ xorrol r9, r1, 22
555
+ ldr r1, [sp, #mDi0]
556
+ ldr r10, [sp, #_ki0]
557
+ eor r8, r8, r4
558
+ xorrol r10, r1, 21
559
+ ldr r1, [sp, #mDo0]
560
+ ldr r11, [sp, #_mo0]
561
+ ldr r12, [sp, #_su1]
562
+ xorrol r11, r1, 10
563
+ xorrol r12, r6, 7
564
+ xandnot r0, _be1, r9, r10, r11
565
+ xandnot r0, _bi1, r10, r11, r12
566
+ xandnot r0, _bo1, r11, r12, r8
567
+ xandnot r0, _bu1, r12, r8, r9
568
+ xandnotRC r0, _ba1, r8, r9, r10
569
+
570
+ ldr r1, [sp, #mDo1]
571
+ ldr r8, [sp, #_bo1]
572
+ ldr r12, [sp, #_si0]
573
+ xorrol r8, r1, 14
574
+ ldr r1, [sp, #mDi0]
575
+ ldr r9, [sp, #_gu1]
576
+ xorrol r12, r1, 30
577
+ ldr r10, [sp, #_ka0]
578
+ ldr r11, [sp, #_me0]
579
+ xorrol r9, r6, 10
580
+ xorrol r10, r5, 1
581
+ xorrol r11, lr, 22
582
+ xandnot r0, _ga1, r8, r9, r10
583
+ xandnot r0, _ge1, r9, r10, r11
584
+ xandnot r0, _gi1, r10, r11, r12
585
+ xandnot r0, _go1, r11, r12, r8
586
+ xandnot r0, _gu1, r12, r8, r9
587
+
588
+ ldr r1, [sp, #mDo0]
589
+ ldr r10, [sp, #_ko0]
590
+ ldr r8, [sp, #_be0]
591
+ xorrol r10, r1, 12
592
+ ldr r9, [sp, #_gi1]
593
+ ldr r11, [sp, #_mu1]
594
+ ldr r12, [sp, #_sa1]
595
+ eor r8, r8, lr
596
+ xorrol r9, r2, 3
597
+ xorrol r11, r6, 4
598
+ xorrol r12, r4, 9
599
+ xandnot r0, _ka1, r8, r9, r10
600
+ xandnot r0, _ke1, r9, r10, r11
601
+ xandnot r0, _ki1, r10, r11, r12
602
+ xandnot r0, _ko1, r11, r12, r8
603
+ xandnot r0, _ku1, r12, r8, r9
604
+
605
+ ldr r1, [sp, #mDe1]
606
+ ldr r10, [sp, #_ke1]
607
+ ldr r11, [sp, #_mi0]
608
+ xorrol r10, r1, 5
609
+ ldr r1, [sp, #mDi0]
610
+ ldr r12, [sp, #_so1]
611
+ xorrol r11, r1, 7
612
+ ldr r1, [sp, #mDo1]
613
+ ldr r8, [sp, #_bu0]
614
+ ldr r9, [sp, #_ga1]
615
+ xorrol r8, r7, 13
616
+ xorrol r9, r4, 18
617
+ xorrol r12, r1, 28
618
+ xandnot r0, _ma1, r8, r9, r10
619
+ xandnot r0, _me1, r9, r10, r11
620
+ xandnot r0, _mi1, r10, r11, r12
621
+ xandnot r0, _mo1, r11, r12, r8
622
+ xandnot r0, _mu1, r12, r8, r9
623
+
624
+ ldr r1, [sp, #mDo0]
625
+ ldr r9, [sp, #_go0]
626
+ ldr r8, [sp, #_bi1]
627
+ xorrol r9, r1, 27
628
+ ldr r10, [sp, #_ku0]
629
+ ldr r11, [sp, #_ma0]
630
+ ldr r12, [sp, #_se1]
631
+ ldr r1, [sp, #mDe1]
632
+ xorrol r8, r2, 31
633
+ xorrol r10, r7, 19
634
+ xorrol r11, r5, 20
635
+ xorrol r12, r1, 1
636
+ xandnot r0, _sa1, r8, r9, r10
637
+ xandnot r0, _se1, r9, r10, r11
638
+ xandnot r0, _si1, r10, r11, r12
639
+ xandnot r0, _so1, r11, r12, r8
640
+ ldr r10, [r3]
641
+ xandnot r0, _su1, r12, r8, r9
642
+
643
+ cmp r10, #0xFFFFFFFF
644
+ bne roundLoop
645
+
646
+ add sp,sp,#4*(50+4)
647
+ pop {r4-r12,pc}
648
+
649
+ ENDP
650
+
651
+ ALIGN
652
+
653
+ END