CANConfigPython 0.1.0a1__py3-none-win_amd64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (165) hide show
  1. canconfigpython/__init__.py +7 -0
  2. canconfigpython/__main__.py +3 -0
  3. canconfigpython/cli.py +111 -0
  4. canconfigpython/client.py +243 -0
  5. canconfigpython/commands.py +57 -0
  6. canconfigpython/errors.py +19 -0
  7. canconfigpython/resources/docs/native-source.tar.gz +0 -0
  8. canconfigpython/resources/docs/user-guide.en.md +274 -0
  9. canconfigpython/resources/docs/user-guide.zh-CN.md +265 -0
  10. canconfigpython/resources/skill/canconfig-python/SKILL.md +71 -0
  11. canconfigpython/resources/skill/canconfig-python/agents/openai.yaml +4 -0
  12. canconfigpython/resources/skill/canconfig-python/assets/changes.schema.json +832 -0
  13. canconfigpython/resources/skill/canconfig-python/assets/examples/bridge_dual_rates.json +18 -0
  14. canconfigpython/resources/skill/canconfig-python/assets/examples/bridge_mapping.json +13 -0
  15. canconfigpython/resources/skill/canconfig-python/assets/examples/cancom_115200_8n1.json +10 -0
  16. canconfigpython/resources/skill/canconfig-python/assets/examples/cancom_format_crc.json +8 -0
  17. canconfigpython/resources/skill/canconfig-python/assets/examples/cancom_gap.json +8 -0
  18. canconfigpython/resources/skill/canconfig-python/assets/examples/cancom_transparent_id.json +10 -0
  19. canconfigpython/resources/skill/canconfig-python/assets/examples/fb_1m.json +12 -0
  20. canconfigpython/resources/skill/canconfig-python/assets/examples/fb_500k.json +12 -0
  21. canconfigpython/resources/skill/canconfig-python/assets/examples/fb_adaptive_single.json +7 -0
  22. canconfigpython/resources/skill/canconfig-python/assets/examples/fb_return_manual.json +22 -0
  23. canconfigpython/resources/skill/canconfig-python/assets/examples/fb_silent_adaptive_option.json +7 -0
  24. canconfigpython/resources/skill/canconfig-python/assets/examples/filter_blacklist.json +7 -0
  25. canconfigpython/resources/skill/canconfig-python/assets/examples/filter_mask.json +12 -0
  26. canconfigpython/resources/skill/canconfig-python/assets/examples/filter_range.json +12 -0
  27. canconfigpython/resources/skill/canconfig-python/assets/examples/hub_h_external.json +13 -0
  28. canconfigpython/resources/skill/canconfig-python/assets/examples/hub_input_filter.json +13 -0
  29. canconfigpython/resources/skill/canconfig-python/assets/examples/hub_l_external.json +13 -0
  30. canconfigpython/resources/skill/canconfig-python/assets/examples/hub_mapping.json +46 -0
  31. canconfigpython/resources/skill/canconfig-python/assets/examples/hub_routing.json +8 -0
  32. canconfigpython/resources/skill/canconfig-python/assets/examples/index.en.md +55 -0
  33. canconfigpython/resources/skill/canconfig-python/assets/examples/index.json +661 -0
  34. canconfigpython/resources/skill/canconfig-python/assets/examples/index.zh-CN.md +55 -0
  35. canconfigpython/resources/skill/canconfig-python/assets/examples/negative/adaptive_mixed.json +8 -0
  36. canconfigpython/resources/skill/canconfig-python/assets/examples/negative/hub_missing_ps.json +12 -0
  37. canconfigpython/resources/skill/canconfig-python/assets/examples/negative/restricted_inheritance.json +12 -0
  38. canconfigpython/resources/skill/canconfig-python/assets/examples/negative/short_user_data.json +7 -0
  39. canconfigpython/resources/skill/canconfig-python/assets/examples/negative/string_numeric_id.json +7 -0
  40. canconfigpython/resources/skill/canconfig-python/assets/examples/negative/unknown_field.json +7 -0
  41. canconfigpython/resources/skill/canconfig-python/assets/examples/negative/unsupported_adaptive.json +7 -0
  42. canconfigpython/resources/skill/canconfig-python/assets/examples/negative/wrong_uid.json +7 -0
  43. canconfigpython/resources/skill/canconfig-python/assets/examples/rpt_adaptive_all.json +12 -0
  44. canconfigpython/resources/skill/canconfig-python/assets/examples/rpt_silent.json +7 -0
  45. canconfigpython/resources/skill/canconfig-python/assets/examples/user_data.json +7 -0
  46. canconfigpython/resources/skill/canconfig-python/references/operations.md +68 -0
  47. canconfigpython/resources.py +17 -0
  48. canconfigpython/runtime/Qt5Core.dll +0 -0
  49. canconfigpython/runtime/Qt5Network.dll +0 -0
  50. canconfigpython/runtime/Qt5SerialPort.dll +0 -0
  51. canconfigpython/runtime/WIICAN.dll +0 -0
  52. canconfigpython/runtime/canconfigconsole.exe +0 -0
  53. canconfigpython/runtime/libgcc_s_dw2-1.dll +0 -0
  54. canconfigpython/runtime/libstdc++-6.dll +0 -0
  55. canconfigpython/runtime/libwinpthread-1.dll +0 -0
  56. canconfigpython/runtime/manifest.json +19 -0
  57. canconfigpython/runtime.py +61 -0
  58. canconfigpython-0.1.0a1.dist-info/GPL-3.0.txt +674 -0
  59. canconfigpython-0.1.0a1.dist-info/LICENSE +21 -0
  60. canconfigpython-0.1.0a1.dist-info/METADATA +197 -0
  61. canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-LICENSE.txt +866 -0
  62. canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-LICENSE.FDL.txt +450 -0
  63. canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-LICENSE.GPL2.txt +339 -0
  64. canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-LICENSE.GPL3-EXCEPT.txt +704 -0
  65. canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-LICENSE.GPL3.txt +674 -0
  66. canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-LICENSE.GPLv3.txt +686 -0
  67. canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-LICENSE.LGPL3.txt +165 -0
  68. canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-LICENSE.LGPLv21.txt +514 -0
  69. canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-LICENSE.LGPLv3.txt +175 -0
  70. canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-LICENSE.PREVIEW.COMMERCIAL.txt +626 -0
  71. canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__angle__LICENSE.txt +32 -0
  72. canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__angle__src__libANGLE__renderer__d3d__d3d11__dxgi_support_data.json.txt +1164 -0
  73. canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__angle__src__libANGLE__renderer__d3d__d3d11__load_functions_data.json.txt +1116 -0
  74. canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__angle__src__libANGLE__renderer__d3d__d3d11__swizzle_format_data.json.txt +77 -0
  75. canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__angle__src__libANGLE__renderer__d3d__d3d11__texture_format_data.json.txt +692 -0
  76. canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__angle__src__third_party__compiler__LICENSE.txt +22 -0
  77. canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__angle__src__third_party__murmurhash__LICENSE.txt +2 -0
  78. canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__double-conversion__LICENSE.txt +26 -0
  79. canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__easing__easing.cpp.txt +670 -0
  80. canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__easing__legal.qdoc.txt +35 -0
  81. canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__forkfd__forkfd.c.txt +875 -0
  82. canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__forkfd__forkfd.h.txt +66 -0
  83. canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__forkfd__forkfd_gcc.h.txt +63 -0
  84. canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__freebsd__0001-Patch-the-FreeBSD-strto-u-ll-functions-to-work-insid.patch.txt +151 -0
  85. canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__freebsd__strtoll.c.txt +134 -0
  86. canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__freebsd__strtoull.c.txt +112 -0
  87. canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__freetype__docs__LICENSE.TXT.txt +37 -0
  88. canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__freetype__src__tools__no-copyright.txt +61 -0
  89. canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__freetype__src__tools__update-copyright-year.txt +135 -0
  90. canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__freetype__src__tools__update-copyright.txt +14 -0
  91. canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__harfbuzz-ng__COPYING.txt +36 -0
  92. canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__harfbuzz__COPYING.txt +24 -0
  93. canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__libpng__LICENSE.txt +112 -0
  94. canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__md4__md4.cpp.txt +265 -0
  95. canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__md4__md4.h.txt +31 -0
  96. canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__md5__md5.cpp.txt +247 -0
  97. canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__md5__md5.h.txt +48 -0
  98. canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__pcre__COPYING.txt +5 -0
  99. canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__pcre__LICENCE.txt +93 -0
  100. canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__rfc6234__patches__0001-Fix-compilation-MSVC-warning-in-3rdparty-rfc6234.patch.txt +86 -0
  101. canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__rfc6234__sha-private.h.txt +28 -0
  102. canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__rfc6234__sha.h.txt +357 -0
  103. canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__rfc6234__sha224-256.c.txt +583 -0
  104. canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__rfc6234__sha384-512.c.txt +1034 -0
  105. canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__sha1__sha1.cpp.txt +261 -0
  106. canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__sha3__KeccakF-1600-32-rvk.macros.txt +555 -0
  107. canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__sha3__KeccakF-1600-32.macros.txt +26 -0
  108. canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__sha3__KeccakF-1600-64.macros.txt +728 -0
  109. canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__sha3__KeccakF-1600-int-set.h.txt +6 -0
  110. canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__sha3__KeccakF-1600-interface.h.txt +46 -0
  111. canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__sha3__KeccakF-1600-opt32-settings.h.txt +4 -0
  112. canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__sha3__KeccakF-1600-opt32.c.txt +524 -0
  113. canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__sha3__KeccakF-1600-opt64-settings.h.txt +7 -0
  114. canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__sha3__KeccakF-1600-opt64.c.txt +512 -0
  115. canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__sha3__KeccakF-1600-unrolling.macros.txt +124 -0
  116. canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__sha3__KeccakNISTInterface.c.txt +82 -0
  117. canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__sha3__KeccakNISTInterface.h.txt +70 -0
  118. canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__sha3__KeccakSponge.c.txt +266 -0
  119. canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__sha3__KeccakSponge.h.txt +80 -0
  120. canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__sha3__brg_endian.h.txt +142 -0
  121. canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__xkbcommon__COPYING.txt +188 -0
  122. canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtserialport-LICENSE.FDL.txt +450 -0
  123. canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtserialport-LICENSE.GPL2.txt +339 -0
  124. canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtserialport-LICENSE.GPL3-EXCEPT.txt +704 -0
  125. canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtserialport-LICENSE.GPL3.txt +674 -0
  126. canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtserialport-LICENSE.GPLv2.txt +292 -0
  127. canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtserialport-LICENSE.GPLv3.txt +686 -0
  128. canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtserialport-LICENSE.LGPL3.txt +165 -0
  129. canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtserialport-LICENSE.LGPLv21.txt +514 -0
  130. canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtserialport-LICENSE.LGPLv3.txt +175 -0
  131. canconfigpython-0.1.0a1.dist-info/RECORD +165 -0
  132. canconfigpython-0.1.0a1.dist-info/THIRD_PARTY_NOTICES.md +69 -0
  133. canconfigpython-0.1.0a1.dist-info/WHEEL +5 -0
  134. canconfigpython-0.1.0a1.dist-info/entry_points.txt +3 -0
  135. canconfigpython-0.1.0a1.dist-info/gcc-COPYING.RUNTIME.txt +73 -0
  136. canconfigpython-0.1.0a1.dist-info/gcc-COPYING3.LIB.txt +165 -0
  137. canconfigpython-0.1.0a1.dist-info/gcc-COPYING3.txt +674 -0
  138. canconfigpython-0.1.0a1.dist-info/linux-libc6-copyright.txt +529 -0
  139. canconfigpython-0.1.0a1.dist-info/linux-libcap2-copyright.txt +112 -0
  140. canconfigpython-0.1.0a1.dist-info/linux-libcom-err2-copyright.txt +403 -0
  141. canconfigpython-0.1.0a1.dist-info/linux-libdouble-conversion3-copyright.txt +41 -0
  142. canconfigpython-0.1.0a1.dist-info/linux-libgcc-s1-copyright.txt +1532 -0
  143. canconfigpython-0.1.0a1.dist-info/linux-libglib2.0-0t64-copyright.txt +1250 -0
  144. canconfigpython-0.1.0a1.dist-info/linux-libgssapi-krb5-2-copyright.txt +1374 -0
  145. canconfigpython-0.1.0a1.dist-info/linux-libicu74-copyright.txt +49 -0
  146. canconfigpython-0.1.0a1.dist-info/linux-libk5crypto3-copyright.txt +1374 -0
  147. canconfigpython-0.1.0a1.dist-info/linux-libkeyutils1-copyright.txt +52 -0
  148. canconfigpython-0.1.0a1.dist-info/linux-libkrb5-3-copyright.txt +1374 -0
  149. canconfigpython-0.1.0a1.dist-info/linux-libkrb5support0-copyright.txt +1374 -0
  150. canconfigpython-0.1.0a1.dist-info/linux-libpcre2-16-0-copyright.txt +122 -0
  151. canconfigpython-0.1.0a1.dist-info/linux-libpcre2-8-0-copyright.txt +122 -0
  152. canconfigpython-0.1.0a1.dist-info/linux-libqt5core5t64-copyright.txt +2932 -0
  153. canconfigpython-0.1.0a1.dist-info/linux-libqt5network5t64-copyright.txt +2932 -0
  154. canconfigpython-0.1.0a1.dist-info/linux-libqt5serialport5-copyright.txt +134 -0
  155. canconfigpython-0.1.0a1.dist-info/linux-libstdc++6-copyright.txt +1532 -0
  156. canconfigpython-0.1.0a1.dist-info/linux-libudev1-copyright.txt +287 -0
  157. canconfigpython-0.1.0a1.dist-info/linux-libzstd1-copyright.txt +123 -0
  158. canconfigpython-0.1.0a1.dist-info/linux-packages.json +102 -0
  159. canconfigpython-0.1.0a1.dist-info/linux-zlib1g-copyright.txt +84 -0
  160. canconfigpython-0.1.0a1.dist-info/mingw-w64-COPYING.MinGW-w64-runtime.txt.txt +240 -0
  161. canconfigpython-0.1.0a1.dist-info/mingw-w64-COPYING.MinGW-w64.txt.txt +135 -0
  162. canconfigpython-0.1.0a1.dist-info/mingw-w64-COPYING.txt +43 -0
  163. canconfigpython-0.1.0a1.dist-info/qt-source-notices.json +278 -0
  164. canconfigpython-0.1.0a1.dist-info/top_level.txt +1 -0
  165. canconfigpython-0.1.0a1.dist-info/winpthreads-COPYING.txt +57 -0
@@ -0,0 +1,6 @@
1
+ #define ProvideFast576
2
+ #define ProvideFast832
3
+ #define ProvideFast1024
4
+ #define ProvideFast1088
5
+ #define ProvideFast1152
6
+ #define ProvideFast1344
@@ -0,0 +1,46 @@
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 the designers,
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
+ #ifndef _KeccakPermutationInterface_h_
15
+ #define _KeccakPermutationInterface_h_
16
+
17
+ #include "KeccakF-1600-int-set.h"
18
+
19
+ static void KeccakInitialize( void );
20
+ static void KeccakInitializeState(unsigned char *state);
21
+ static void KeccakPermutation(unsigned char *state);
22
+ #ifdef ProvideFast576
23
+ static void KeccakAbsorb576bits(unsigned char *state, const unsigned char *data);
24
+ #endif
25
+ #ifdef ProvideFast832
26
+ static void KeccakAbsorb832bits(unsigned char *state, const unsigned char *data);
27
+ #endif
28
+ #ifdef ProvideFast1024
29
+ static void KeccakAbsorb1024bits(unsigned char *state, const unsigned char *data);
30
+ #endif
31
+ #ifdef ProvideFast1088
32
+ static void KeccakAbsorb1088bits(unsigned char *state, const unsigned char *data);
33
+ #endif
34
+ #ifdef ProvideFast1152
35
+ static void KeccakAbsorb1152bits(unsigned char *state, const unsigned char *data);
36
+ #endif
37
+ #ifdef ProvideFast1344
38
+ static void KeccakAbsorb1344bits(unsigned char *state, const unsigned char *data);
39
+ #endif
40
+ static void KeccakAbsorb(unsigned char *state, const unsigned char *data, unsigned int laneCount);
41
+ #ifdef ProvideFast1024
42
+ static void KeccakExtract1024bits(const unsigned char *state, unsigned char *data);
43
+ #endif
44
+ static void KeccakExtract(const unsigned char *state, unsigned char *data, unsigned int laneCount);
45
+
46
+ #endif
@@ -0,0 +1,4 @@
1
+ #define Unrolling 2
2
+ //#define UseBebigokimisa
3
+ //#define UseInterleaveTables
4
+ #define UseSchedule 3
@@ -0,0 +1,524 @@
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 the designers,
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 <string.h>
15
+ #include "brg_endian.h"
16
+ #include "KeccakF-1600-opt32-settings.h"
17
+ #include "KeccakF-1600-interface.h"
18
+
19
+ typedef unsigned char UINT8;
20
+ typedef unsigned short UINT16;
21
+ typedef unsigned int UINT32;
22
+ typedef unsigned long long int UINT64;
23
+
24
+ #ifdef UseInterleaveTables
25
+ int interleaveTablesBuilt = 0;
26
+ UINT16 interleaveTable[65536];
27
+ UINT16 deinterleaveTable[65536];
28
+
29
+ static void buildInterleaveTables()
30
+ {
31
+ UINT32 i, j;
32
+ UINT16 x;
33
+
34
+ if (!interleaveTablesBuilt) {
35
+ for(i=0; i<65536; i++) {
36
+ x = 0;
37
+ for(j=0; j<16; j++) {
38
+ if (i & (1 << j))
39
+ x |= (1 << (j/2 + 8*(j%2)));
40
+ }
41
+ interleaveTable[i] = x;
42
+ deinterleaveTable[x] = (UINT16)i;
43
+ }
44
+ interleaveTablesBuilt = 1;
45
+ }
46
+ }
47
+
48
+ #if (PLATFORM_BYTE_ORDER == IS_LITTLE_ENDIAN)
49
+
50
+ #define xor2bytesIntoInterleavedWords(even, odd, source, j) \
51
+ i##j = interleaveTable[((const UINT16*)source)[j]]; \
52
+ ((UINT8*)even)[j] ^= i##j & 0xFF; \
53
+ ((UINT8*)odd)[j] ^= i##j >> 8;
54
+
55
+ #define setInterleavedWordsInto2bytes(dest, even, odd, j) \
56
+ d##j = deinterleaveTable[((even >> (j*8)) & 0xFF) ^ (((odd >> (j*8)) & 0xFF) << 8)]; \
57
+ ((UINT16*)dest)[j] = d##j;
58
+
59
+ #else // (PLATFORM_BYTE_ORDER == IS_BIG_ENDIAN)
60
+
61
+ #define xor2bytesIntoInterleavedWords(even, odd, source, j) \
62
+ i##j = interleaveTable[source[2*j] ^ ((UINT16)source[2*j+1] << 8)]; \
63
+ *even ^= (i##j & 0xFF) << (j*8); \
64
+ *odd ^= ((i##j >> 8) & 0xFF) << (j*8);
65
+
66
+ #define setInterleavedWordsInto2bytes(dest, even, odd, j) \
67
+ d##j = deinterleaveTable[((even >> (j*8)) & 0xFF) ^ (((odd >> (j*8)) & 0xFF) << 8)]; \
68
+ dest[2*j] = d##j & 0xFF; \
69
+ dest[2*j+1] = d##j >> 8;
70
+
71
+ #endif // Endianness
72
+
73
+ static void xor8bytesIntoInterleavedWords(UINT32 *even, UINT32 *odd, const UINT8* source)
74
+ {
75
+ UINT16 i0, i1, i2, i3;
76
+
77
+ xor2bytesIntoInterleavedWords(even, odd, source, 0)
78
+ xor2bytesIntoInterleavedWords(even, odd, source, 1)
79
+ xor2bytesIntoInterleavedWords(even, odd, source, 2)
80
+ xor2bytesIntoInterleavedWords(even, odd, source, 3)
81
+ }
82
+
83
+ #define xorLanesIntoState(laneCount, state, input) \
84
+ { \
85
+ int i; \
86
+ for(i=0; i<(laneCount); i++) \
87
+ xor8bytesIntoInterleavedWords(state+i*2, state+i*2+1, input+i*8); \
88
+ }
89
+
90
+ static void setInterleavedWordsInto8bytes(UINT8* dest, UINT32 even, UINT32 odd)
91
+ {
92
+ UINT16 d0, d1, d2, d3;
93
+
94
+ setInterleavedWordsInto2bytes(dest, even, odd, 0)
95
+ setInterleavedWordsInto2bytes(dest, even, odd, 1)
96
+ setInterleavedWordsInto2bytes(dest, even, odd, 2)
97
+ setInterleavedWordsInto2bytes(dest, even, odd, 3)
98
+ }
99
+
100
+ #define extractLanes(laneCount, state, data) \
101
+ { \
102
+ int i; \
103
+ for(i=0; i<(laneCount); i++) \
104
+ setInterleavedWordsInto8bytes(data+i*8, ((UINT32*)state)[i*2], ((UINT32*)state)[i*2+1]); \
105
+ }
106
+
107
+ #else // No interleaving tables
108
+
109
+ #if (PLATFORM_BYTE_ORDER == IS_LITTLE_ENDIAN)
110
+
111
+ // Credit: Henry S. Warren, Hacker's Delight, Addison-Wesley, 2002
112
+ #define xorInterleavedLE(rateInLanes, state, input) \
113
+ { \
114
+ const UINT32 * pI = (const UINT32 *)input; \
115
+ UINT32 * pS = state; \
116
+ UINT32 t, x0, x1; \
117
+ int i; \
118
+ for (i = (int)(rateInLanes)-1; i >= 0; --i) \
119
+ { \
120
+ x0 = *(pI++); \
121
+ t = (x0 ^ (x0 >> 1)) & 0x22222222UL; x0 = x0 ^ t ^ (t << 1); \
122
+ t = (x0 ^ (x0 >> 2)) & 0x0C0C0C0CUL; x0 = x0 ^ t ^ (t << 2); \
123
+ t = (x0 ^ (x0 >> 4)) & 0x00F000F0UL; x0 = x0 ^ t ^ (t << 4); \
124
+ t = (x0 ^ (x0 >> 8)) & 0x0000FF00UL; x0 = x0 ^ t ^ (t << 8); \
125
+ x1 = *(pI++); \
126
+ t = (x1 ^ (x1 >> 1)) & 0x22222222UL; x1 = x1 ^ t ^ (t << 1); \
127
+ t = (x1 ^ (x1 >> 2)) & 0x0C0C0C0CUL; x1 = x1 ^ t ^ (t << 2); \
128
+ t = (x1 ^ (x1 >> 4)) & 0x00F000F0UL; x1 = x1 ^ t ^ (t << 4); \
129
+ t = (x1 ^ (x1 >> 8)) & 0x0000FF00UL; x1 = x1 ^ t ^ (t << 8); \
130
+ *(pS++) ^= (UINT16)x0 | (x1 << 16); \
131
+ *(pS++) ^= (x0 >> 16) | (x1 & 0xFFFF0000); \
132
+ } \
133
+ }
134
+
135
+ #define xorLanesIntoState(laneCount, state, input) \
136
+ xorInterleavedLE(laneCount, state, input)
137
+
138
+ #else // (PLATFORM_BYTE_ORDER == IS_BIG_ENDIAN)
139
+
140
+ // Credit: Henry S. Warren, Hacker's Delight, Addison-Wesley, 2002
141
+ static UINT64 toInterleaving(UINT64 x)
142
+ {
143
+ UINT64 t;
144
+
145
+ t = (x ^ (x >> 1)) & 0x2222222222222222ULL; x = x ^ t ^ (t << 1);
146
+ t = (x ^ (x >> 2)) & 0x0C0C0C0C0C0C0C0CULL; x = x ^ t ^ (t << 2);
147
+ t = (x ^ (x >> 4)) & 0x00F000F000F000F0ULL; x = x ^ t ^ (t << 4);
148
+ t = (x ^ (x >> 8)) & 0x0000FF000000FF00ULL; x = x ^ t ^ (t << 8);
149
+ t = (x ^ (x >> 16)) & 0x00000000FFFF0000ULL; x = x ^ t ^ (t << 16);
150
+
151
+ return x;
152
+ }
153
+
154
+ static void xor8bytesIntoInterleavedWords(UINT32* evenAndOdd, const UINT8* source)
155
+ {
156
+ // This can be optimized
157
+ UINT64 sourceWord =
158
+ (UINT64)source[0]
159
+ ^ (((UINT64)source[1]) << 8)
160
+ ^ (((UINT64)source[2]) << 16)
161
+ ^ (((UINT64)source[3]) << 24)
162
+ ^ (((UINT64)source[4]) << 32)
163
+ ^ (((UINT64)source[5]) << 40)
164
+ ^ (((UINT64)source[6]) << 48)
165
+ ^ (((UINT64)source[7]) << 56);
166
+ UINT64 evenAndOddWord = toInterleaving(sourceWord);
167
+ evenAndOdd[0] ^= (UINT32)evenAndOddWord;
168
+ evenAndOdd[1] ^= (UINT32)(evenAndOddWord >> 32);
169
+ }
170
+
171
+ #define xorLanesIntoState(laneCount, state, input) \
172
+ { \
173
+ unsigned i; \
174
+ for(i=0; i<(laneCount); i++) \
175
+ xor8bytesIntoInterleavedWords(state+i*2, input+i*8); \
176
+ }
177
+
178
+ #endif // Endianness
179
+
180
+ // Credit: Henry S. Warren, Hacker's Delight, Addison-Wesley, 2002
181
+ static UINT64 fromInterleaving(UINT64 x)
182
+ {
183
+ UINT64 t;
184
+
185
+ t = (x ^ (x >> 16)) & 0x00000000FFFF0000ULL; x = x ^ t ^ (t << 16);
186
+ t = (x ^ (x >> 8)) & 0x0000FF000000FF00ULL; x = x ^ t ^ (t << 8);
187
+ t = (x ^ (x >> 4)) & 0x00F000F000F000F0ULL; x = x ^ t ^ (t << 4);
188
+ t = (x ^ (x >> 2)) & 0x0C0C0C0C0C0C0C0CULL; x = x ^ t ^ (t << 2);
189
+ t = (x ^ (x >> 1)) & 0x2222222222222222ULL; x = x ^ t ^ (t << 1);
190
+
191
+ return x;
192
+ }
193
+
194
+ static void setInterleavedWordsInto8bytes(UINT8* dest, const UINT32* evenAndOdd)
195
+ {
196
+ #if (PLATFORM_BYTE_ORDER == IS_LITTLE_ENDIAN)
197
+ ((UINT64*)dest)[0] = fromInterleaving(*(const UINT64*)evenAndOdd);
198
+ #else // (PLATFORM_BYTE_ORDER == IS_BIG_ENDIAN)
199
+ // This can be optimized
200
+ UINT64 evenAndOddWord = (UINT64)evenAndOdd[0] ^ ((UINT64)evenAndOdd[1] << 32);
201
+ UINT64 destWord = fromInterleaving(evenAndOddWord);
202
+ dest[0] = destWord & 0xFF;
203
+ dest[1] = (destWord >> 8) & 0xFF;
204
+ dest[2] = (destWord >> 16) & 0xFF;
205
+ dest[3] = (destWord >> 24) & 0xFF;
206
+ dest[4] = (destWord >> 32) & 0xFF;
207
+ dest[5] = (destWord >> 40) & 0xFF;
208
+ dest[6] = (destWord >> 48) & 0xFF;
209
+ dest[7] = (destWord >> 56) & 0xFF;
210
+ #endif // Endianness
211
+ }
212
+
213
+ #define extractLanes(laneCount, state, data) \
214
+ { \
215
+ unsigned i; \
216
+ for(i=0; i<(laneCount); i++) \
217
+ setInterleavedWordsInto8bytes(data+i*8, (const UINT32*)state+i*2); \
218
+ }
219
+
220
+ #endif // With or without interleaving tables
221
+
222
+ #if defined(_MSC_VER)
223
+ #define ROL32(a, offset) _rotl(a, offset)
224
+ #elif (defined (__arm__) && defined(__ARMCC_VERSION))
225
+ #define ROL32(a, offset) __ror(a, 32-(offset))
226
+ #else
227
+ #define ROL32(a, offset) ((((UINT32)a) << (offset)) ^ (((UINT32)a) >> (32-(offset))))
228
+ #endif
229
+
230
+ #include "KeccakF-1600-unrolling.macros"
231
+ #include "KeccakF-1600-32.macros"
232
+
233
+ #if (UseSchedule == 3)
234
+
235
+ #ifdef UseBebigokimisa
236
+ #error "No lane complementing with schedule 3."
237
+ #endif
238
+
239
+ #if (Unrolling != 2)
240
+ #error "Only unrolling 2 is supported by schedule 3."
241
+ #endif
242
+
243
+ static void KeccakPermutationOnWords(UINT32 *state)
244
+ {
245
+ rounds
246
+ }
247
+
248
+ static void KeccakPermutationOnWordsAfterXoring(UINT32 *state, const UINT8 *input, unsigned int laneCount)
249
+ {
250
+ xorLanesIntoState(laneCount, state, input)
251
+ rounds
252
+ }
253
+
254
+ #ifdef ProvideFast576
255
+ static void KeccakPermutationOnWordsAfterXoring576bits(UINT32 *state, const UINT8 *input)
256
+ {
257
+ xorLanesIntoState(9, state, input)
258
+ rounds
259
+ }
260
+ #endif
261
+
262
+ #ifdef ProvideFast832
263
+ static void KeccakPermutationOnWordsAfterXoring832bits(UINT32 *state, const UINT8 *input)
264
+ {
265
+ xorLanesIntoState(13, state, input)
266
+ rounds
267
+ }
268
+ #endif
269
+
270
+ #ifdef ProvideFast1024
271
+ static void KeccakPermutationOnWordsAfterXoring1024bits(UINT32 *state, const UINT8 *input)
272
+ {
273
+ xorLanesIntoState(16, state, input)
274
+ rounds
275
+ }
276
+ #endif
277
+
278
+ #ifdef ProvideFast1088
279
+ static void KeccakPermutationOnWordsAfterXoring1088bits(UINT32 *state, const UINT8 *input)
280
+ {
281
+ xorLanesIntoState(17, state, input)
282
+ rounds
283
+ }
284
+ #endif
285
+
286
+ #ifdef ProvideFast1152
287
+ static void KeccakPermutationOnWordsAfterXoring1152bits(UINT32 *state, const UINT8 *input)
288
+ {
289
+ xorLanesIntoState(18, state, input)
290
+ rounds
291
+ }
292
+ #endif
293
+
294
+ #ifdef ProvideFast1344
295
+ static void KeccakPermutationOnWordsAfterXoring1344bits(UINT32 *state, const UINT8 *input)
296
+ {
297
+ xorLanesIntoState(21, state, input)
298
+ rounds
299
+ }
300
+ #endif
301
+
302
+ #else // (Schedule != 3)
303
+
304
+ static void KeccakPermutationOnWords(UINT32 *state)
305
+ {
306
+ declareABCDE
307
+ #if (Unrolling != 24)
308
+ unsigned int i;
309
+ #endif
310
+
311
+ copyFromState(A, state)
312
+ rounds
313
+ }
314
+
315
+ static void KeccakPermutationOnWordsAfterXoring(UINT32 *state, const UINT8 *input, unsigned int laneCount)
316
+ {
317
+ declareABCDE
318
+ unsigned int i;
319
+
320
+ xorLanesIntoState(laneCount, state, input)
321
+ copyFromState(A, state)
322
+ rounds
323
+ }
324
+
325
+ #ifdef ProvideFast576
326
+ static void KeccakPermutationOnWordsAfterXoring576bits(UINT32 *state, const UINT8 *input)
327
+ {
328
+ declareABCDE
329
+ unsigned int i;
330
+
331
+ xorLanesIntoState(9, state, input)
332
+ copyFromState(A, state)
333
+ rounds
334
+ }
335
+ #endif
336
+
337
+ #ifdef ProvideFast832
338
+ static void KeccakPermutationOnWordsAfterXoring832bits(UINT32 *state, const UINT8 *input)
339
+ {
340
+ declareABCDE
341
+ unsigned int i;
342
+
343
+ xorLanesIntoState(13, state, input)
344
+ copyFromState(A, state)
345
+ rounds
346
+ }
347
+ #endif
348
+
349
+ #ifdef ProvideFast1024
350
+ static void KeccakPermutationOnWordsAfterXoring1024bits(UINT32 *state, const UINT8 *input)
351
+ {
352
+ declareABCDE
353
+ unsigned int i;
354
+
355
+ xorLanesIntoState(16, state, input)
356
+ copyFromState(A, state)
357
+ rounds
358
+ }
359
+ #endif
360
+
361
+ #ifdef ProvideFast1088
362
+ static void KeccakPermutationOnWordsAfterXoring1088bits(UINT32 *state, const UINT8 *input)
363
+ {
364
+ declareABCDE
365
+ unsigned int i;
366
+
367
+ xorLanesIntoState(17, state, input)
368
+ copyFromState(A, state)
369
+ rounds
370
+ }
371
+ #endif
372
+
373
+ #ifdef ProvideFast1152
374
+ static void KeccakPermutationOnWordsAfterXoring1152bits(UINT32 *state, const UINT8 *input)
375
+ {
376
+ declareABCDE
377
+ unsigned int i;
378
+
379
+ xorLanesIntoState(18, state, input)
380
+ copyFromState(A, state)
381
+ rounds
382
+ }
383
+ #endif
384
+
385
+ #ifdef ProvideFast1344
386
+ static void KeccakPermutationOnWordsAfterXoring1344bits(UINT32 *state, const UINT8 *input)
387
+ {
388
+ declareABCDE
389
+ unsigned int i;
390
+
391
+ xorLanesIntoState(21, state, input)
392
+ copyFromState(A, state)
393
+ rounds
394
+ }
395
+ #endif
396
+
397
+ #endif
398
+
399
+ static void KeccakInitialize()
400
+ {
401
+ #ifdef UseInterleaveTables
402
+ buildInterleaveTables();
403
+ #endif
404
+ }
405
+
406
+ static void KeccakInitializeState(unsigned char *state)
407
+ {
408
+ memset(state, 0, 200);
409
+ #ifdef UseBebigokimisa
410
+ ((UINT32*)state)[ 2] = ~(UINT32)0;
411
+ ((UINT32*)state)[ 3] = ~(UINT32)0;
412
+ ((UINT32*)state)[ 4] = ~(UINT32)0;
413
+ ((UINT32*)state)[ 5] = ~(UINT32)0;
414
+ ((UINT32*)state)[16] = ~(UINT32)0;
415
+ ((UINT32*)state)[17] = ~(UINT32)0;
416
+ ((UINT32*)state)[24] = ~(UINT32)0;
417
+ ((UINT32*)state)[25] = ~(UINT32)0;
418
+ ((UINT32*)state)[34] = ~(UINT32)0;
419
+ ((UINT32*)state)[35] = ~(UINT32)0;
420
+ ((UINT32*)state)[40] = ~(UINT32)0;
421
+ ((UINT32*)state)[41] = ~(UINT32)0;
422
+ #endif
423
+ }
424
+
425
+ static void KeccakPermutation(unsigned char *state)
426
+ {
427
+ // We assume the state is always stored as interleaved 32-bit words
428
+ KeccakPermutationOnWords((UINT32*)state);
429
+ }
430
+
431
+ #ifdef ProvideFast576
432
+ static void KeccakAbsorb576bits(unsigned char *state, const unsigned char *data)
433
+ {
434
+ KeccakPermutationOnWordsAfterXoring576bits((UINT32*)state, data);
435
+ }
436
+ #endif
437
+
438
+ #ifdef ProvideFast832
439
+ static void KeccakAbsorb832bits(unsigned char *state, const unsigned char *data)
440
+ {
441
+ KeccakPermutationOnWordsAfterXoring832bits((UINT32*)state, data);
442
+ }
443
+ #endif
444
+
445
+ #ifdef ProvideFast1024
446
+ static void KeccakAbsorb1024bits(unsigned char *state, const unsigned char *data)
447
+ {
448
+ KeccakPermutationOnWordsAfterXoring1024bits((UINT32*)state, data);
449
+ }
450
+ #endif
451
+
452
+ #ifdef ProvideFast1088
453
+ static void KeccakAbsorb1088bits(unsigned char *state, const unsigned char *data)
454
+ {
455
+ KeccakPermutationOnWordsAfterXoring1088bits((UINT32*)state, data);
456
+ }
457
+ #endif
458
+
459
+ #ifdef ProvideFast1152
460
+ static void KeccakAbsorb1152bits(unsigned char *state, const unsigned char *data)
461
+ {
462
+ KeccakPermutationOnWordsAfterXoring1152bits((UINT32*)state, data);
463
+ }
464
+ #endif
465
+
466
+ #ifdef ProvideFast1344
467
+ static void KeccakAbsorb1344bits(unsigned char *state, const unsigned char *data)
468
+ {
469
+ KeccakPermutationOnWordsAfterXoring1344bits((UINT32*)state, data);
470
+ }
471
+ #endif
472
+
473
+ static void KeccakAbsorb(unsigned char *state, const unsigned char *data, unsigned int laneCount)
474
+ {
475
+ KeccakPermutationOnWordsAfterXoring((UINT32*)state, data, laneCount);
476
+ }
477
+
478
+ #ifdef ProvideFast1024
479
+ static void KeccakExtract1024bits(const unsigned char *state, unsigned char *data)
480
+ {
481
+ extractLanes(16, state, data)
482
+ #ifdef UseBebigokimisa
483
+ ((UINT32*)data)[ 2] = ~((UINT32*)data)[ 2];
484
+ ((UINT32*)data)[ 3] = ~((UINT32*)data)[ 3];
485
+ ((UINT32*)data)[ 4] = ~((UINT32*)data)[ 4];
486
+ ((UINT32*)data)[ 5] = ~((UINT32*)data)[ 5];
487
+ ((UINT32*)data)[16] = ~((UINT32*)data)[16];
488
+ ((UINT32*)data)[17] = ~((UINT32*)data)[17];
489
+ ((UINT32*)data)[24] = ~((UINT32*)data)[24];
490
+ ((UINT32*)data)[25] = ~((UINT32*)data)[25];
491
+ #endif
492
+ }
493
+ #endif
494
+
495
+ static void KeccakExtract(const unsigned char *state, unsigned char *data, unsigned int laneCount)
496
+ {
497
+ extractLanes(laneCount, state, data)
498
+ #ifdef UseBebigokimisa
499
+ if (laneCount > 1) {
500
+ ((UINT32*)data)[ 2] = ~((UINT32*)data)[ 2];
501
+ ((UINT32*)data)[ 3] = ~((UINT32*)data)[ 3];
502
+ if (laneCount > 2) {
503
+ ((UINT32*)data)[ 4] = ~((UINT32*)data)[ 4];
504
+ ((UINT32*)data)[ 5] = ~((UINT32*)data)[ 5];
505
+ if (laneCount > 8) {
506
+ ((UINT32*)data)[16] = ~((UINT32*)data)[16];
507
+ ((UINT32*)data)[17] = ~((UINT32*)data)[17];
508
+ if (laneCount > 12) {
509
+ ((UINT32*)data)[24] = ~((UINT32*)data)[24];
510
+ ((UINT32*)data)[25] = ~((UINT32*)data)[25];
511
+ if (laneCount > 17) {
512
+ ((UINT32*)data)[34] = ~((UINT32*)data)[34];
513
+ ((UINT32*)data)[35] = ~((UINT32*)data)[35];
514
+ if (laneCount > 20) {
515
+ ((UINT32*)data)[40] = ~((UINT32*)data)[40];
516
+ ((UINT32*)data)[41] = ~((UINT32*)data)[41];
517
+ }
518
+ }
519
+ }
520
+ }
521
+ }
522
+ }
523
+ #endif
524
+ }
@@ -0,0 +1,7 @@
1
+ #define Unrolling 24
2
+ #define UseBebigokimisa
3
+ //#define UseSSE
4
+ //#define UseOnlySIMD64
5
+ //#define UseMMX
6
+ //#define UseSHLD
7
+ //#define UseXOP