CANConfigPython 0.1.0a1__py3-none-win32.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.
- canconfigpython/__init__.py +7 -0
- canconfigpython/__main__.py +3 -0
- canconfigpython/cli.py +111 -0
- canconfigpython/client.py +243 -0
- canconfigpython/commands.py +57 -0
- canconfigpython/errors.py +19 -0
- canconfigpython/resources/docs/native-source.tar.gz +0 -0
- canconfigpython/resources/docs/user-guide.en.md +274 -0
- canconfigpython/resources/docs/user-guide.zh-CN.md +265 -0
- canconfigpython/resources/skill/canconfig-python/SKILL.md +71 -0
- canconfigpython/resources/skill/canconfig-python/agents/openai.yaml +4 -0
- canconfigpython/resources/skill/canconfig-python/assets/changes.schema.json +832 -0
- canconfigpython/resources/skill/canconfig-python/assets/examples/bridge_dual_rates.json +18 -0
- canconfigpython/resources/skill/canconfig-python/assets/examples/bridge_mapping.json +13 -0
- canconfigpython/resources/skill/canconfig-python/assets/examples/cancom_115200_8n1.json +10 -0
- canconfigpython/resources/skill/canconfig-python/assets/examples/cancom_format_crc.json +8 -0
- canconfigpython/resources/skill/canconfig-python/assets/examples/cancom_gap.json +8 -0
- canconfigpython/resources/skill/canconfig-python/assets/examples/cancom_transparent_id.json +10 -0
- canconfigpython/resources/skill/canconfig-python/assets/examples/fb_1m.json +12 -0
- canconfigpython/resources/skill/canconfig-python/assets/examples/fb_500k.json +12 -0
- canconfigpython/resources/skill/canconfig-python/assets/examples/fb_adaptive_single.json +7 -0
- canconfigpython/resources/skill/canconfig-python/assets/examples/fb_return_manual.json +22 -0
- canconfigpython/resources/skill/canconfig-python/assets/examples/fb_silent_adaptive_option.json +7 -0
- canconfigpython/resources/skill/canconfig-python/assets/examples/filter_blacklist.json +7 -0
- canconfigpython/resources/skill/canconfig-python/assets/examples/filter_mask.json +12 -0
- canconfigpython/resources/skill/canconfig-python/assets/examples/filter_range.json +12 -0
- canconfigpython/resources/skill/canconfig-python/assets/examples/hub_h_external.json +13 -0
- canconfigpython/resources/skill/canconfig-python/assets/examples/hub_input_filter.json +13 -0
- canconfigpython/resources/skill/canconfig-python/assets/examples/hub_l_external.json +13 -0
- canconfigpython/resources/skill/canconfig-python/assets/examples/hub_mapping.json +46 -0
- canconfigpython/resources/skill/canconfig-python/assets/examples/hub_routing.json +8 -0
- canconfigpython/resources/skill/canconfig-python/assets/examples/index.en.md +55 -0
- canconfigpython/resources/skill/canconfig-python/assets/examples/index.json +661 -0
- canconfigpython/resources/skill/canconfig-python/assets/examples/index.zh-CN.md +55 -0
- canconfigpython/resources/skill/canconfig-python/assets/examples/negative/adaptive_mixed.json +8 -0
- canconfigpython/resources/skill/canconfig-python/assets/examples/negative/hub_missing_ps.json +12 -0
- canconfigpython/resources/skill/canconfig-python/assets/examples/negative/restricted_inheritance.json +12 -0
- canconfigpython/resources/skill/canconfig-python/assets/examples/negative/short_user_data.json +7 -0
- canconfigpython/resources/skill/canconfig-python/assets/examples/negative/string_numeric_id.json +7 -0
- canconfigpython/resources/skill/canconfig-python/assets/examples/negative/unknown_field.json +7 -0
- canconfigpython/resources/skill/canconfig-python/assets/examples/negative/unsupported_adaptive.json +7 -0
- canconfigpython/resources/skill/canconfig-python/assets/examples/negative/wrong_uid.json +7 -0
- canconfigpython/resources/skill/canconfig-python/assets/examples/rpt_adaptive_all.json +12 -0
- canconfigpython/resources/skill/canconfig-python/assets/examples/rpt_silent.json +7 -0
- canconfigpython/resources/skill/canconfig-python/assets/examples/user_data.json +7 -0
- canconfigpython/resources/skill/canconfig-python/references/operations.md +68 -0
- canconfigpython/resources.py +17 -0
- canconfigpython/runtime/Qt5Core.dll +0 -0
- canconfigpython/runtime/Qt5Network.dll +0 -0
- canconfigpython/runtime/Qt5SerialPort.dll +0 -0
- canconfigpython/runtime/WIICAN.dll +0 -0
- canconfigpython/runtime/canconfigconsole.exe +0 -0
- canconfigpython/runtime/libgcc_s_dw2-1.dll +0 -0
- canconfigpython/runtime/libstdc++-6.dll +0 -0
- canconfigpython/runtime/libwinpthread-1.dll +0 -0
- canconfigpython/runtime/manifest.json +19 -0
- canconfigpython/runtime.py +61 -0
- canconfigpython-0.1.0a1.dist-info/GPL-3.0.txt +674 -0
- canconfigpython-0.1.0a1.dist-info/LICENSE +21 -0
- canconfigpython-0.1.0a1.dist-info/METADATA +197 -0
- canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-LICENSE.txt +866 -0
- canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-LICENSE.FDL.txt +450 -0
- canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-LICENSE.GPL2.txt +339 -0
- canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-LICENSE.GPL3-EXCEPT.txt +704 -0
- canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-LICENSE.GPL3.txt +674 -0
- canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-LICENSE.GPLv3.txt +686 -0
- canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-LICENSE.LGPL3.txt +165 -0
- canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-LICENSE.LGPLv21.txt +514 -0
- canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-LICENSE.LGPLv3.txt +175 -0
- canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-LICENSE.PREVIEW.COMMERCIAL.txt +626 -0
- canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__angle__LICENSE.txt +32 -0
- 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
- 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
- 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
- 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
- canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__angle__src__third_party__compiler__LICENSE.txt +22 -0
- canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__angle__src__third_party__murmurhash__LICENSE.txt +2 -0
- canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__double-conversion__LICENSE.txt +26 -0
- canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__easing__easing.cpp.txt +670 -0
- canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__easing__legal.qdoc.txt +35 -0
- canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__forkfd__forkfd.c.txt +875 -0
- canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__forkfd__forkfd.h.txt +66 -0
- canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__forkfd__forkfd_gcc.h.txt +63 -0
- 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
- canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__freebsd__strtoll.c.txt +134 -0
- canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__freebsd__strtoull.c.txt +112 -0
- canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__freetype__docs__LICENSE.TXT.txt +37 -0
- canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__freetype__src__tools__no-copyright.txt +61 -0
- canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__freetype__src__tools__update-copyright-year.txt +135 -0
- canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__freetype__src__tools__update-copyright.txt +14 -0
- canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__harfbuzz-ng__COPYING.txt +36 -0
- canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__harfbuzz__COPYING.txt +24 -0
- canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__libpng__LICENSE.txt +112 -0
- canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__md4__md4.cpp.txt +265 -0
- canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__md4__md4.h.txt +31 -0
- canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__md5__md5.cpp.txt +247 -0
- canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__md5__md5.h.txt +48 -0
- canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__pcre__COPYING.txt +5 -0
- canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__pcre__LICENCE.txt +93 -0
- 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
- canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__rfc6234__sha-private.h.txt +28 -0
- canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__rfc6234__sha.h.txt +357 -0
- canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__rfc6234__sha224-256.c.txt +583 -0
- canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__rfc6234__sha384-512.c.txt +1034 -0
- canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__sha1__sha1.cpp.txt +261 -0
- canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__sha3__KeccakF-1600-32-rvk.macros.txt +555 -0
- canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__sha3__KeccakF-1600-32.macros.txt +26 -0
- canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__sha3__KeccakF-1600-64.macros.txt +728 -0
- canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__sha3__KeccakF-1600-int-set.h.txt +6 -0
- canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__sha3__KeccakF-1600-interface.h.txt +46 -0
- canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__sha3__KeccakF-1600-opt32-settings.h.txt +4 -0
- canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__sha3__KeccakF-1600-opt32.c.txt +524 -0
- canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__sha3__KeccakF-1600-opt64-settings.h.txt +7 -0
- canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__sha3__KeccakF-1600-opt64.c.txt +512 -0
- canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__sha3__KeccakF-1600-unrolling.macros.txt +124 -0
- canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__sha3__KeccakNISTInterface.c.txt +82 -0
- canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__sha3__KeccakNISTInterface.h.txt +70 -0
- canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__sha3__KeccakSponge.c.txt +266 -0
- canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__sha3__KeccakSponge.h.txt +80 -0
- canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__sha3__brg_endian.h.txt +142 -0
- canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__xkbcommon__COPYING.txt +188 -0
- canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtserialport-LICENSE.FDL.txt +450 -0
- canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtserialport-LICENSE.GPL2.txt +339 -0
- canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtserialport-LICENSE.GPL3-EXCEPT.txt +704 -0
- canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtserialport-LICENSE.GPL3.txt +674 -0
- canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtserialport-LICENSE.GPLv2.txt +292 -0
- canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtserialport-LICENSE.GPLv3.txt +686 -0
- canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtserialport-LICENSE.LGPL3.txt +165 -0
- canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtserialport-LICENSE.LGPLv21.txt +514 -0
- canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtserialport-LICENSE.LGPLv3.txt +175 -0
- canconfigpython-0.1.0a1.dist-info/RECORD +165 -0
- canconfigpython-0.1.0a1.dist-info/THIRD_PARTY_NOTICES.md +69 -0
- canconfigpython-0.1.0a1.dist-info/WHEEL +5 -0
- canconfigpython-0.1.0a1.dist-info/entry_points.txt +3 -0
- canconfigpython-0.1.0a1.dist-info/gcc-COPYING.RUNTIME.txt +73 -0
- canconfigpython-0.1.0a1.dist-info/gcc-COPYING3.LIB.txt +165 -0
- canconfigpython-0.1.0a1.dist-info/gcc-COPYING3.txt +674 -0
- canconfigpython-0.1.0a1.dist-info/linux-libc6-copyright.txt +529 -0
- canconfigpython-0.1.0a1.dist-info/linux-libcap2-copyright.txt +112 -0
- canconfigpython-0.1.0a1.dist-info/linux-libcom-err2-copyright.txt +403 -0
- canconfigpython-0.1.0a1.dist-info/linux-libdouble-conversion3-copyright.txt +41 -0
- canconfigpython-0.1.0a1.dist-info/linux-libgcc-s1-copyright.txt +1532 -0
- canconfigpython-0.1.0a1.dist-info/linux-libglib2.0-0t64-copyright.txt +1250 -0
- canconfigpython-0.1.0a1.dist-info/linux-libgssapi-krb5-2-copyright.txt +1374 -0
- canconfigpython-0.1.0a1.dist-info/linux-libicu74-copyright.txt +49 -0
- canconfigpython-0.1.0a1.dist-info/linux-libk5crypto3-copyright.txt +1374 -0
- canconfigpython-0.1.0a1.dist-info/linux-libkeyutils1-copyright.txt +52 -0
- canconfigpython-0.1.0a1.dist-info/linux-libkrb5-3-copyright.txt +1374 -0
- canconfigpython-0.1.0a1.dist-info/linux-libkrb5support0-copyright.txt +1374 -0
- canconfigpython-0.1.0a1.dist-info/linux-libpcre2-16-0-copyright.txt +122 -0
- canconfigpython-0.1.0a1.dist-info/linux-libpcre2-8-0-copyright.txt +122 -0
- canconfigpython-0.1.0a1.dist-info/linux-libqt5core5t64-copyright.txt +2932 -0
- canconfigpython-0.1.0a1.dist-info/linux-libqt5network5t64-copyright.txt +2932 -0
- canconfigpython-0.1.0a1.dist-info/linux-libqt5serialport5-copyright.txt +134 -0
- canconfigpython-0.1.0a1.dist-info/linux-libstdc++6-copyright.txt +1532 -0
- canconfigpython-0.1.0a1.dist-info/linux-libudev1-copyright.txt +287 -0
- canconfigpython-0.1.0a1.dist-info/linux-libzstd1-copyright.txt +123 -0
- canconfigpython-0.1.0a1.dist-info/linux-packages.json +102 -0
- canconfigpython-0.1.0a1.dist-info/linux-zlib1g-copyright.txt +84 -0
- canconfigpython-0.1.0a1.dist-info/mingw-w64-COPYING.MinGW-w64-runtime.txt.txt +240 -0
- canconfigpython-0.1.0a1.dist-info/mingw-w64-COPYING.MinGW-w64.txt.txt +135 -0
- canconfigpython-0.1.0a1.dist-info/mingw-w64-COPYING.txt +43 -0
- canconfigpython-0.1.0a1.dist-info/qt-source-notices.json +278 -0
- canconfigpython-0.1.0a1.dist-info/top_level.txt +1 -0
- canconfigpython-0.1.0a1.dist-info/winpthreads-COPYING.txt +57 -0
canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__sha3__KeccakF-1600-opt64.c.txt
ADDED
|
@@ -0,0 +1,512 @@
|
|
|
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-opt64-settings.h"
|
|
17
|
+
#include "KeccakF-1600-interface.h"
|
|
18
|
+
|
|
19
|
+
typedef unsigned char UINT8;
|
|
20
|
+
typedef unsigned long long int UINT64;
|
|
21
|
+
|
|
22
|
+
#if defined(UseSSE) || defined(UseXOP)
|
|
23
|
+
#if defined(__GNUC__)
|
|
24
|
+
#define ALIGN __attribute__ ((aligned(32)))
|
|
25
|
+
#elif defined(_MSC_VER)
|
|
26
|
+
#define ALIGN __declspec(align(32))
|
|
27
|
+
#endif
|
|
28
|
+
#endif
|
|
29
|
+
|
|
30
|
+
#ifndef ALIGN
|
|
31
|
+
# define ALIGN
|
|
32
|
+
#endif
|
|
33
|
+
|
|
34
|
+
#if defined(UseSSE)
|
|
35
|
+
#include <x86intrin.h>
|
|
36
|
+
typedef __m128i V64;
|
|
37
|
+
typedef __m128i V128;
|
|
38
|
+
typedef union {
|
|
39
|
+
V128 v128;
|
|
40
|
+
UINT64 v64[2];
|
|
41
|
+
} V6464;
|
|
42
|
+
|
|
43
|
+
#define ANDnu64(a, b) _mm_andnot_si128(a, b)
|
|
44
|
+
#define LOAD64(a) _mm_loadl_epi64((const V64 *)&(a))
|
|
45
|
+
#define CONST64(a) _mm_loadl_epi64((const V64 *)&(a))
|
|
46
|
+
#define ROL64(a, o) _mm_or_si128(_mm_slli_epi64(a, o), _mm_srli_epi64(a, 64-(o)))
|
|
47
|
+
#define STORE64(a, b) _mm_storel_epi64((V64 *)&(a), b)
|
|
48
|
+
#define XOR64(a, b) _mm_xor_si128(a, b)
|
|
49
|
+
#define XOReq64(a, b) a = _mm_xor_si128(a, b)
|
|
50
|
+
#define SHUFFLEBYTES128(a, b) _mm_shuffle_epi8(a, b)
|
|
51
|
+
|
|
52
|
+
#define ANDnu128(a, b) _mm_andnot_si128(a, b)
|
|
53
|
+
#define LOAD6464(a, b) _mm_set_epi64((__m64)(a), (__m64)(b))
|
|
54
|
+
#define CONST128(a) _mm_load_si128((const V128 *)&(a))
|
|
55
|
+
#define LOAD128(a) _mm_load_si128((const V128 *)&(a))
|
|
56
|
+
#define LOAD128u(a) _mm_loadu_si128((const V128 *)&(a))
|
|
57
|
+
#define ROL64in128(a, o) _mm_or_si128(_mm_slli_epi64(a, o), _mm_srli_epi64(a, 64-(o)))
|
|
58
|
+
#define STORE128(a, b) _mm_store_si128((V128 *)&(a), b)
|
|
59
|
+
#define XOR128(a, b) _mm_xor_si128(a, b)
|
|
60
|
+
#define XOReq128(a, b) a = _mm_xor_si128(a, b)
|
|
61
|
+
#define GET64LOLO(a, b) _mm_unpacklo_epi64(a, b)
|
|
62
|
+
#define GET64HIHI(a, b) _mm_unpackhi_epi64(a, b)
|
|
63
|
+
#define COPY64HI2LO(a) _mm_shuffle_epi32(a, 0xEE)
|
|
64
|
+
#define COPY64LO2HI(a) _mm_shuffle_epi32(a, 0x44)
|
|
65
|
+
#define ZERO128() _mm_setzero_si128()
|
|
66
|
+
|
|
67
|
+
#ifdef UseOnlySIMD64
|
|
68
|
+
#include "KeccakF-1600-simd64.macros"
|
|
69
|
+
#else
|
|
70
|
+
ALIGN const UINT64 rho8_56[2] = {0x0605040302010007, 0x080F0E0D0C0B0A09};
|
|
71
|
+
#include "KeccakF-1600-simd128.macros"
|
|
72
|
+
#endif
|
|
73
|
+
|
|
74
|
+
#ifdef UseBebigokimisa
|
|
75
|
+
#error "UseBebigokimisa cannot be used in combination with UseSSE"
|
|
76
|
+
#endif
|
|
77
|
+
#elif defined(UseXOP)
|
|
78
|
+
#include <x86intrin.h>
|
|
79
|
+
typedef __m128i V64;
|
|
80
|
+
typedef __m128i V128;
|
|
81
|
+
|
|
82
|
+
#define LOAD64(a) _mm_loadl_epi64((const V64 *)&(a))
|
|
83
|
+
#define CONST64(a) _mm_loadl_epi64((const V64 *)&(a))
|
|
84
|
+
#define STORE64(a, b) _mm_storel_epi64((V64 *)&(a), b)
|
|
85
|
+
#define XOR64(a, b) _mm_xor_si128(a, b)
|
|
86
|
+
#define XOReq64(a, b) a = _mm_xor_si128(a, b)
|
|
87
|
+
|
|
88
|
+
#define ANDnu128(a, b) _mm_andnot_si128(a, b)
|
|
89
|
+
#define LOAD6464(a, b) _mm_set_epi64((__m64)(a), (__m64)(b))
|
|
90
|
+
#define CONST128(a) _mm_load_si128((const V128 *)&(a))
|
|
91
|
+
#define LOAD128(a) _mm_load_si128((const V128 *)&(a))
|
|
92
|
+
#define LOAD128u(a) _mm_loadu_si128((const V128 *)&(a))
|
|
93
|
+
#define STORE128(a, b) _mm_store_si128((V128 *)&(a), b)
|
|
94
|
+
#define XOR128(a, b) _mm_xor_si128(a, b)
|
|
95
|
+
#define XOReq128(a, b) a = _mm_xor_si128(a, b)
|
|
96
|
+
#define ZERO128() _mm_setzero_si128()
|
|
97
|
+
|
|
98
|
+
#define SWAP64(a) _mm_shuffle_epi32(a, 0x4E)
|
|
99
|
+
#define GET64LOLO(a, b) _mm_unpacklo_epi64(a, b)
|
|
100
|
+
#define GET64HIHI(a, b) _mm_unpackhi_epi64(a, b)
|
|
101
|
+
#define GET64LOHI(a, b) ((__m128i)_mm_blend_pd((__m128d)a, (__m128d)b, 2))
|
|
102
|
+
#define GET64HILO(a, b) SWAP64(GET64LOHI(b, a))
|
|
103
|
+
#define COPY64HI2LO(a) _mm_shuffle_epi32(a, 0xEE)
|
|
104
|
+
#define COPY64LO2HI(a) _mm_shuffle_epi32(a, 0x44)
|
|
105
|
+
|
|
106
|
+
#define ROL6464same(a, o) _mm_roti_epi64(a, o)
|
|
107
|
+
#define ROL6464(a, r1, r2) _mm_rot_epi64(a, CONST128( rot_##r1##_##r2 ))
|
|
108
|
+
ALIGN const UINT64 rot_0_20[2] = { 0, 20};
|
|
109
|
+
ALIGN const UINT64 rot_44_3[2] = {44, 3};
|
|
110
|
+
ALIGN const UINT64 rot_43_45[2] = {43, 45};
|
|
111
|
+
ALIGN const UINT64 rot_21_61[2] = {21, 61};
|
|
112
|
+
ALIGN const UINT64 rot_14_28[2] = {14, 28};
|
|
113
|
+
ALIGN const UINT64 rot_1_36[2] = { 1, 36};
|
|
114
|
+
ALIGN const UINT64 rot_6_10[2] = { 6, 10};
|
|
115
|
+
ALIGN const UINT64 rot_25_15[2] = {25, 15};
|
|
116
|
+
ALIGN const UINT64 rot_8_56[2] = { 8, 56};
|
|
117
|
+
ALIGN const UINT64 rot_18_27[2] = {18, 27};
|
|
118
|
+
ALIGN const UINT64 rot_62_55[2] = {62, 55};
|
|
119
|
+
ALIGN const UINT64 rot_39_41[2] = {39, 41};
|
|
120
|
+
|
|
121
|
+
#if defined(UseSimulatedXOP)
|
|
122
|
+
// For debugging purposes, when XOP is not available
|
|
123
|
+
#undef ROL6464
|
|
124
|
+
#undef ROL6464same
|
|
125
|
+
#define ROL6464same(a, o) _mm_or_si128(_mm_slli_epi64(a, o), _mm_srli_epi64(a, 64-(o)))
|
|
126
|
+
V128 ROL6464(V128 a, int r0, int r1)
|
|
127
|
+
{
|
|
128
|
+
V128 a0 = ROL64(a, r0);
|
|
129
|
+
V128 a1 = COPY64HI2LO(ROL64(a, r1));
|
|
130
|
+
return GET64LOLO(a0, a1);
|
|
131
|
+
}
|
|
132
|
+
#endif
|
|
133
|
+
|
|
134
|
+
#include "KeccakF-1600-xop.macros"
|
|
135
|
+
|
|
136
|
+
#ifdef UseBebigokimisa
|
|
137
|
+
#error "UseBebigokimisa cannot be used in combination with UseXOP"
|
|
138
|
+
#endif
|
|
139
|
+
#elif defined(UseMMX)
|
|
140
|
+
#include <mmintrin.h>
|
|
141
|
+
typedef __m64 V64;
|
|
142
|
+
#define ANDnu64(a, b) _mm_andnot_si64(a, b)
|
|
143
|
+
|
|
144
|
+
#if (defined(_MSC_VER) || defined (__INTEL_COMPILER))
|
|
145
|
+
#define LOAD64(a) *(V64*)&(a)
|
|
146
|
+
#define CONST64(a) *(V64*)&(a)
|
|
147
|
+
#define STORE64(a, b) *(V64*)&(a) = b
|
|
148
|
+
#else
|
|
149
|
+
#define LOAD64(a) (V64)a
|
|
150
|
+
#define CONST64(a) (V64)a
|
|
151
|
+
#define STORE64(a, b) a = (UINT64)b
|
|
152
|
+
#endif
|
|
153
|
+
#define ROL64(a, o) _mm_or_si64(_mm_slli_si64(a, o), _mm_srli_si64(a, 64-(o)))
|
|
154
|
+
#define XOR64(a, b) _mm_xor_si64(a, b)
|
|
155
|
+
#define XOReq64(a, b) a = _mm_xor_si64(a, b)
|
|
156
|
+
|
|
157
|
+
#include "KeccakF-1600-simd64.macros"
|
|
158
|
+
|
|
159
|
+
#ifdef UseBebigokimisa
|
|
160
|
+
#error "UseBebigokimisa cannot be used in combination with UseMMX"
|
|
161
|
+
#endif
|
|
162
|
+
#else
|
|
163
|
+
#if defined(_MSC_VER)
|
|
164
|
+
#define ROL64(a, offset) _rotl64(a, offset)
|
|
165
|
+
#elif defined(UseSHLD)
|
|
166
|
+
#define ROL64(x,N) ({ \
|
|
167
|
+
register UINT64 __out; \
|
|
168
|
+
register UINT64 __in = x; \
|
|
169
|
+
__asm__ ("shld %2,%0,%0" : "=r"(__out) : "0"(__in), "i"(N)); \
|
|
170
|
+
__out; \
|
|
171
|
+
})
|
|
172
|
+
#else
|
|
173
|
+
#define ROL64(a, offset) ((((UINT64)a) << offset) ^ (((UINT64)a) >> (64-offset)))
|
|
174
|
+
#endif
|
|
175
|
+
|
|
176
|
+
#include "KeccakF-1600-64.macros"
|
|
177
|
+
#endif
|
|
178
|
+
|
|
179
|
+
#include "KeccakF-1600-unrolling.macros"
|
|
180
|
+
|
|
181
|
+
static void KeccakPermutationOnWords(UINT64 *state)
|
|
182
|
+
{
|
|
183
|
+
declareABCDE
|
|
184
|
+
#if (Unrolling != 24)
|
|
185
|
+
unsigned int i;
|
|
186
|
+
#endif
|
|
187
|
+
|
|
188
|
+
copyFromState(A, state)
|
|
189
|
+
rounds
|
|
190
|
+
#if defined(UseMMX)
|
|
191
|
+
_mm_empty();
|
|
192
|
+
#endif
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
static void KeccakPermutationOnWordsAfterXoring(UINT64 *state, const UINT64 *input, unsigned int laneCount)
|
|
196
|
+
{
|
|
197
|
+
declareABCDE
|
|
198
|
+
#if (Unrolling != 24)
|
|
199
|
+
unsigned int i;
|
|
200
|
+
#endif
|
|
201
|
+
unsigned int j;
|
|
202
|
+
|
|
203
|
+
for(j=0; j<laneCount; j++)
|
|
204
|
+
state[j] ^= input[j];
|
|
205
|
+
copyFromState(A, state)
|
|
206
|
+
rounds
|
|
207
|
+
#if defined(UseMMX)
|
|
208
|
+
_mm_empty();
|
|
209
|
+
#endif
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
#ifdef ProvideFast576
|
|
213
|
+
static void KeccakPermutationOnWordsAfterXoring576bits(UINT64 *state, const UINT64 *input)
|
|
214
|
+
{
|
|
215
|
+
declareABCDE
|
|
216
|
+
#if (Unrolling != 24)
|
|
217
|
+
unsigned int i;
|
|
218
|
+
#endif
|
|
219
|
+
|
|
220
|
+
copyFromStateAndXor576bits(A, state, input)
|
|
221
|
+
rounds
|
|
222
|
+
#if defined(UseMMX)
|
|
223
|
+
_mm_empty();
|
|
224
|
+
#endif
|
|
225
|
+
}
|
|
226
|
+
#endif
|
|
227
|
+
|
|
228
|
+
#ifdef ProvideFast832
|
|
229
|
+
static void KeccakPermutationOnWordsAfterXoring832bits(UINT64 *state, const UINT64 *input)
|
|
230
|
+
{
|
|
231
|
+
declareABCDE
|
|
232
|
+
#if (Unrolling != 24)
|
|
233
|
+
unsigned int i;
|
|
234
|
+
#endif
|
|
235
|
+
|
|
236
|
+
copyFromStateAndXor832bits(A, state, input)
|
|
237
|
+
rounds
|
|
238
|
+
#if defined(UseMMX)
|
|
239
|
+
_mm_empty();
|
|
240
|
+
#endif
|
|
241
|
+
}
|
|
242
|
+
#endif
|
|
243
|
+
|
|
244
|
+
#ifdef ProvideFast1024
|
|
245
|
+
static void KeccakPermutationOnWordsAfterXoring1024bits(UINT64 *state, const UINT64 *input)
|
|
246
|
+
{
|
|
247
|
+
declareABCDE
|
|
248
|
+
#if (Unrolling != 24)
|
|
249
|
+
unsigned int i;
|
|
250
|
+
#endif
|
|
251
|
+
|
|
252
|
+
copyFromStateAndXor1024bits(A, state, input)
|
|
253
|
+
rounds
|
|
254
|
+
#if defined(UseMMX)
|
|
255
|
+
_mm_empty();
|
|
256
|
+
#endif
|
|
257
|
+
}
|
|
258
|
+
#endif
|
|
259
|
+
|
|
260
|
+
#ifdef ProvideFast1088
|
|
261
|
+
static void KeccakPermutationOnWordsAfterXoring1088bits(UINT64 *state, const UINT64 *input)
|
|
262
|
+
{
|
|
263
|
+
declareABCDE
|
|
264
|
+
#if (Unrolling != 24)
|
|
265
|
+
unsigned int i;
|
|
266
|
+
#endif
|
|
267
|
+
|
|
268
|
+
copyFromStateAndXor1088bits(A, state, input)
|
|
269
|
+
rounds
|
|
270
|
+
#if defined(UseMMX)
|
|
271
|
+
_mm_empty();
|
|
272
|
+
#endif
|
|
273
|
+
}
|
|
274
|
+
#endif
|
|
275
|
+
|
|
276
|
+
#ifdef ProvideFast1152
|
|
277
|
+
static void KeccakPermutationOnWordsAfterXoring1152bits(UINT64 *state, const UINT64 *input)
|
|
278
|
+
{
|
|
279
|
+
declareABCDE
|
|
280
|
+
#if (Unrolling != 24)
|
|
281
|
+
unsigned int i;
|
|
282
|
+
#endif
|
|
283
|
+
|
|
284
|
+
copyFromStateAndXor1152bits(A, state, input)
|
|
285
|
+
rounds
|
|
286
|
+
#if defined(UseMMX)
|
|
287
|
+
_mm_empty();
|
|
288
|
+
#endif
|
|
289
|
+
}
|
|
290
|
+
#endif
|
|
291
|
+
|
|
292
|
+
#ifdef ProvideFast1344
|
|
293
|
+
static void KeccakPermutationOnWordsAfterXoring1344bits(UINT64 *state, const UINT64 *input)
|
|
294
|
+
{
|
|
295
|
+
declareABCDE
|
|
296
|
+
#if (Unrolling != 24)
|
|
297
|
+
unsigned int i;
|
|
298
|
+
#endif
|
|
299
|
+
|
|
300
|
+
copyFromStateAndXor1344bits(A, state, input)
|
|
301
|
+
rounds
|
|
302
|
+
#if defined(UseMMX)
|
|
303
|
+
_mm_empty();
|
|
304
|
+
#endif
|
|
305
|
+
}
|
|
306
|
+
#endif
|
|
307
|
+
|
|
308
|
+
static void KeccakInitialize()
|
|
309
|
+
{
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
static void KeccakInitializeState(unsigned char *state)
|
|
313
|
+
{
|
|
314
|
+
memset(state, 0, 200);
|
|
315
|
+
#ifdef UseBebigokimisa
|
|
316
|
+
((UINT64*)state)[ 1] = ~(UINT64)0;
|
|
317
|
+
((UINT64*)state)[ 2] = ~(UINT64)0;
|
|
318
|
+
((UINT64*)state)[ 8] = ~(UINT64)0;
|
|
319
|
+
((UINT64*)state)[12] = ~(UINT64)0;
|
|
320
|
+
((UINT64*)state)[17] = ~(UINT64)0;
|
|
321
|
+
((UINT64*)state)[20] = ~(UINT64)0;
|
|
322
|
+
#endif
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
static void KeccakPermutation(unsigned char *state)
|
|
326
|
+
{
|
|
327
|
+
// We assume the state is always stored as words
|
|
328
|
+
KeccakPermutationOnWords((UINT64*)state);
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
#if (PLATFORM_BYTE_ORDER == IS_BIG_ENDIAN)
|
|
332
|
+
static void fromBytesToWord(UINT64 *word, const UINT8 *bytes)
|
|
333
|
+
{
|
|
334
|
+
unsigned int i;
|
|
335
|
+
|
|
336
|
+
*word = 0;
|
|
337
|
+
for(i=0; i<(64/8); i++)
|
|
338
|
+
*word |= (UINT64)(bytes[i]) << (8*i);
|
|
339
|
+
}
|
|
340
|
+
#endif
|
|
341
|
+
|
|
342
|
+
#ifdef ProvideFast576
|
|
343
|
+
static void KeccakAbsorb576bits(unsigned char *state, const unsigned char *data)
|
|
344
|
+
{
|
|
345
|
+
#if (PLATFORM_BYTE_ORDER == IS_LITTLE_ENDIAN)
|
|
346
|
+
KeccakPermutationOnWordsAfterXoring576bits((UINT64*)state, (const UINT64*)data);
|
|
347
|
+
#else
|
|
348
|
+
UINT64 dataAsWords[9];
|
|
349
|
+
unsigned int i;
|
|
350
|
+
|
|
351
|
+
for(i=0; i<9; i++)
|
|
352
|
+
fromBytesToWord(dataAsWords+i, data+(i*8));
|
|
353
|
+
KeccakPermutationOnWordsAfterXoring576bits((UINT64*)state, dataAsWords);
|
|
354
|
+
#endif
|
|
355
|
+
}
|
|
356
|
+
#endif
|
|
357
|
+
|
|
358
|
+
#ifdef ProvideFast832
|
|
359
|
+
static void KeccakAbsorb832bits(unsigned char *state, const unsigned char *data)
|
|
360
|
+
{
|
|
361
|
+
#if (PLATFORM_BYTE_ORDER == IS_LITTLE_ENDIAN)
|
|
362
|
+
KeccakPermutationOnWordsAfterXoring832bits((UINT64*)state, (const UINT64*)data);
|
|
363
|
+
#else
|
|
364
|
+
UINT64 dataAsWords[13];
|
|
365
|
+
unsigned int i;
|
|
366
|
+
|
|
367
|
+
for(i=0; i<13; i++)
|
|
368
|
+
fromBytesToWord(dataAsWords+i, data+(i*8));
|
|
369
|
+
KeccakPermutationOnWordsAfterXoring832bits((UINT64*)state, dataAsWords);
|
|
370
|
+
#endif
|
|
371
|
+
}
|
|
372
|
+
#endif
|
|
373
|
+
|
|
374
|
+
#ifdef ProvideFast1024
|
|
375
|
+
static void KeccakAbsorb1024bits(unsigned char *state, const unsigned char *data)
|
|
376
|
+
{
|
|
377
|
+
#if (PLATFORM_BYTE_ORDER == IS_LITTLE_ENDIAN)
|
|
378
|
+
KeccakPermutationOnWordsAfterXoring1024bits((UINT64*)state, (const UINT64*)data);
|
|
379
|
+
#else
|
|
380
|
+
UINT64 dataAsWords[16];
|
|
381
|
+
unsigned int i;
|
|
382
|
+
|
|
383
|
+
for(i=0; i<16; i++)
|
|
384
|
+
fromBytesToWord(dataAsWords+i, data+(i*8));
|
|
385
|
+
KeccakPermutationOnWordsAfterXoring1024bits((UINT64*)state, dataAsWords);
|
|
386
|
+
#endif
|
|
387
|
+
}
|
|
388
|
+
#endif
|
|
389
|
+
|
|
390
|
+
#ifdef ProvideFast1088
|
|
391
|
+
static void KeccakAbsorb1088bits(unsigned char *state, const unsigned char *data)
|
|
392
|
+
{
|
|
393
|
+
#if (PLATFORM_BYTE_ORDER == IS_LITTLE_ENDIAN)
|
|
394
|
+
KeccakPermutationOnWordsAfterXoring1088bits((UINT64*)state, (const UINT64*)data);
|
|
395
|
+
#else
|
|
396
|
+
UINT64 dataAsWords[17];
|
|
397
|
+
unsigned int i;
|
|
398
|
+
|
|
399
|
+
for(i=0; i<17; i++)
|
|
400
|
+
fromBytesToWord(dataAsWords+i, data+(i*8));
|
|
401
|
+
KeccakPermutationOnWordsAfterXoring1088bits((UINT64*)state, dataAsWords);
|
|
402
|
+
#endif
|
|
403
|
+
}
|
|
404
|
+
#endif
|
|
405
|
+
|
|
406
|
+
#ifdef ProvideFast1152
|
|
407
|
+
static void KeccakAbsorb1152bits(unsigned char *state, const unsigned char *data)
|
|
408
|
+
{
|
|
409
|
+
#if (PLATFORM_BYTE_ORDER == IS_LITTLE_ENDIAN)
|
|
410
|
+
KeccakPermutationOnWordsAfterXoring1152bits((UINT64*)state, (const UINT64*)data);
|
|
411
|
+
#else
|
|
412
|
+
UINT64 dataAsWords[18];
|
|
413
|
+
unsigned int i;
|
|
414
|
+
|
|
415
|
+
for(i=0; i<18; i++)
|
|
416
|
+
fromBytesToWord(dataAsWords+i, data+(i*8));
|
|
417
|
+
KeccakPermutationOnWordsAfterXoring1152bits((UINT64*)state, dataAsWords);
|
|
418
|
+
#endif
|
|
419
|
+
}
|
|
420
|
+
#endif
|
|
421
|
+
|
|
422
|
+
#ifdef ProvideFast1344
|
|
423
|
+
static void KeccakAbsorb1344bits(unsigned char *state, const unsigned char *data)
|
|
424
|
+
{
|
|
425
|
+
#if (PLATFORM_BYTE_ORDER == IS_LITTLE_ENDIAN)
|
|
426
|
+
KeccakPermutationOnWordsAfterXoring1344bits((UINT64*)state, (const UINT64*)data);
|
|
427
|
+
#else
|
|
428
|
+
UINT64 dataAsWords[21];
|
|
429
|
+
unsigned int i;
|
|
430
|
+
|
|
431
|
+
for(i=0; i<21; i++)
|
|
432
|
+
fromBytesToWord(dataAsWords+i, data+(i*8));
|
|
433
|
+
KeccakPermutationOnWordsAfterXoring1344bits((UINT64*)state, dataAsWords);
|
|
434
|
+
#endif
|
|
435
|
+
}
|
|
436
|
+
#endif
|
|
437
|
+
|
|
438
|
+
static void KeccakAbsorb(unsigned char *state, const unsigned char *data, unsigned int laneCount)
|
|
439
|
+
{
|
|
440
|
+
#if (PLATFORM_BYTE_ORDER == IS_LITTLE_ENDIAN)
|
|
441
|
+
KeccakPermutationOnWordsAfterXoring((UINT64*)state, (const UINT64*)data, laneCount);
|
|
442
|
+
#else
|
|
443
|
+
UINT64 dataAsWords[25];
|
|
444
|
+
unsigned int i;
|
|
445
|
+
|
|
446
|
+
for(i=0; i<laneCount; i++)
|
|
447
|
+
fromBytesToWord(dataAsWords+i, data+(i*8));
|
|
448
|
+
KeccakPermutationOnWordsAfterXoring((UINT64*)state, dataAsWords, laneCount);
|
|
449
|
+
#endif
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
#if (PLATFORM_BYTE_ORDER == IS_BIG_ENDIAN)
|
|
453
|
+
static void fromWordToBytes(UINT8 *bytes, const UINT64 word)
|
|
454
|
+
{
|
|
455
|
+
unsigned int i;
|
|
456
|
+
|
|
457
|
+
for(i=0; i<(64/8); i++)
|
|
458
|
+
bytes[i] = (word >> (8*i)) & 0xFF;
|
|
459
|
+
}
|
|
460
|
+
#endif
|
|
461
|
+
|
|
462
|
+
#ifdef ProvideFast1024
|
|
463
|
+
static void KeccakExtract1024bits(const unsigned char *state, unsigned char *data)
|
|
464
|
+
{
|
|
465
|
+
#if (PLATFORM_BYTE_ORDER == IS_LITTLE_ENDIAN)
|
|
466
|
+
memcpy(data, state, 128);
|
|
467
|
+
#else
|
|
468
|
+
unsigned int i;
|
|
469
|
+
|
|
470
|
+
for(i=0; i<16; i++)
|
|
471
|
+
fromWordToBytes(data+(i*8), ((const UINT64*)state)[i]);
|
|
472
|
+
#endif
|
|
473
|
+
#ifdef UseBebigokimisa
|
|
474
|
+
((UINT64*)data)[ 1] = ~((UINT64*)data)[ 1];
|
|
475
|
+
((UINT64*)data)[ 2] = ~((UINT64*)data)[ 2];
|
|
476
|
+
((UINT64*)data)[ 8] = ~((UINT64*)data)[ 8];
|
|
477
|
+
((UINT64*)data)[12] = ~((UINT64*)data)[12];
|
|
478
|
+
#endif
|
|
479
|
+
}
|
|
480
|
+
#endif
|
|
481
|
+
|
|
482
|
+
static void KeccakExtract(const unsigned char *state, unsigned char *data, unsigned int laneCount)
|
|
483
|
+
{
|
|
484
|
+
#if (PLATFORM_BYTE_ORDER == IS_LITTLE_ENDIAN)
|
|
485
|
+
memcpy(data, state, laneCount*8);
|
|
486
|
+
#else
|
|
487
|
+
unsigned int i;
|
|
488
|
+
|
|
489
|
+
for(i=0; i<laneCount; i++)
|
|
490
|
+
fromWordToBytes(data+(i*8), ((const UINT64*)state)[i]);
|
|
491
|
+
#endif
|
|
492
|
+
#ifdef UseBebigokimisa
|
|
493
|
+
if (laneCount > 1) {
|
|
494
|
+
((UINT64*)data)[ 1] = ~((UINT64*)data)[ 1];
|
|
495
|
+
if (laneCount > 2) {
|
|
496
|
+
((UINT64*)data)[ 2] = ~((UINT64*)data)[ 2];
|
|
497
|
+
if (laneCount > 8) {
|
|
498
|
+
((UINT64*)data)[ 8] = ~((UINT64*)data)[ 8];
|
|
499
|
+
if (laneCount > 12) {
|
|
500
|
+
((UINT64*)data)[12] = ~((UINT64*)data)[12];
|
|
501
|
+
if (laneCount > 17) {
|
|
502
|
+
((UINT64*)data)[17] = ~((UINT64*)data)[17];
|
|
503
|
+
if (laneCount > 20) {
|
|
504
|
+
((UINT64*)data)[20] = ~((UINT64*)data)[20];
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
#endif
|
|
512
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
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
|
+
#if (Unrolling == 24)
|
|
15
|
+
#define rounds \
|
|
16
|
+
prepareTheta \
|
|
17
|
+
thetaRhoPiChiIotaPrepareTheta( 0, A, E) \
|
|
18
|
+
thetaRhoPiChiIotaPrepareTheta( 1, E, A) \
|
|
19
|
+
thetaRhoPiChiIotaPrepareTheta( 2, A, E) \
|
|
20
|
+
thetaRhoPiChiIotaPrepareTheta( 3, E, A) \
|
|
21
|
+
thetaRhoPiChiIotaPrepareTheta( 4, A, E) \
|
|
22
|
+
thetaRhoPiChiIotaPrepareTheta( 5, E, A) \
|
|
23
|
+
thetaRhoPiChiIotaPrepareTheta( 6, A, E) \
|
|
24
|
+
thetaRhoPiChiIotaPrepareTheta( 7, E, A) \
|
|
25
|
+
thetaRhoPiChiIotaPrepareTheta( 8, A, E) \
|
|
26
|
+
thetaRhoPiChiIotaPrepareTheta( 9, E, A) \
|
|
27
|
+
thetaRhoPiChiIotaPrepareTheta(10, A, E) \
|
|
28
|
+
thetaRhoPiChiIotaPrepareTheta(11, E, A) \
|
|
29
|
+
thetaRhoPiChiIotaPrepareTheta(12, A, E) \
|
|
30
|
+
thetaRhoPiChiIotaPrepareTheta(13, E, A) \
|
|
31
|
+
thetaRhoPiChiIotaPrepareTheta(14, A, E) \
|
|
32
|
+
thetaRhoPiChiIotaPrepareTheta(15, E, A) \
|
|
33
|
+
thetaRhoPiChiIotaPrepareTheta(16, A, E) \
|
|
34
|
+
thetaRhoPiChiIotaPrepareTheta(17, E, A) \
|
|
35
|
+
thetaRhoPiChiIotaPrepareTheta(18, A, E) \
|
|
36
|
+
thetaRhoPiChiIotaPrepareTheta(19, E, A) \
|
|
37
|
+
thetaRhoPiChiIotaPrepareTheta(20, A, E) \
|
|
38
|
+
thetaRhoPiChiIotaPrepareTheta(21, E, A) \
|
|
39
|
+
thetaRhoPiChiIotaPrepareTheta(22, A, E) \
|
|
40
|
+
thetaRhoPiChiIota(23, E, A) \
|
|
41
|
+
copyToState(state, A)
|
|
42
|
+
#elif (Unrolling == 12)
|
|
43
|
+
#define rounds \
|
|
44
|
+
prepareTheta \
|
|
45
|
+
for(i=0; i<24; i+=12) { \
|
|
46
|
+
thetaRhoPiChiIotaPrepareTheta(i , A, E) \
|
|
47
|
+
thetaRhoPiChiIotaPrepareTheta(i+ 1, E, A) \
|
|
48
|
+
thetaRhoPiChiIotaPrepareTheta(i+ 2, A, E) \
|
|
49
|
+
thetaRhoPiChiIotaPrepareTheta(i+ 3, E, A) \
|
|
50
|
+
thetaRhoPiChiIotaPrepareTheta(i+ 4, A, E) \
|
|
51
|
+
thetaRhoPiChiIotaPrepareTheta(i+ 5, E, A) \
|
|
52
|
+
thetaRhoPiChiIotaPrepareTheta(i+ 6, A, E) \
|
|
53
|
+
thetaRhoPiChiIotaPrepareTheta(i+ 7, E, A) \
|
|
54
|
+
thetaRhoPiChiIotaPrepareTheta(i+ 8, A, E) \
|
|
55
|
+
thetaRhoPiChiIotaPrepareTheta(i+ 9, E, A) \
|
|
56
|
+
thetaRhoPiChiIotaPrepareTheta(i+10, A, E) \
|
|
57
|
+
thetaRhoPiChiIotaPrepareTheta(i+11, E, A) \
|
|
58
|
+
} \
|
|
59
|
+
copyToState(state, A)
|
|
60
|
+
#elif (Unrolling == 8)
|
|
61
|
+
#define rounds \
|
|
62
|
+
prepareTheta \
|
|
63
|
+
for(i=0; i<24; i+=8) { \
|
|
64
|
+
thetaRhoPiChiIotaPrepareTheta(i , A, E) \
|
|
65
|
+
thetaRhoPiChiIotaPrepareTheta(i+1, E, A) \
|
|
66
|
+
thetaRhoPiChiIotaPrepareTheta(i+2, A, E) \
|
|
67
|
+
thetaRhoPiChiIotaPrepareTheta(i+3, E, A) \
|
|
68
|
+
thetaRhoPiChiIotaPrepareTheta(i+4, A, E) \
|
|
69
|
+
thetaRhoPiChiIotaPrepareTheta(i+5, E, A) \
|
|
70
|
+
thetaRhoPiChiIotaPrepareTheta(i+6, A, E) \
|
|
71
|
+
thetaRhoPiChiIotaPrepareTheta(i+7, E, A) \
|
|
72
|
+
} \
|
|
73
|
+
copyToState(state, A)
|
|
74
|
+
#elif (Unrolling == 6)
|
|
75
|
+
#define rounds \
|
|
76
|
+
prepareTheta \
|
|
77
|
+
for(i=0; i<24; i+=6) { \
|
|
78
|
+
thetaRhoPiChiIotaPrepareTheta(i , A, E) \
|
|
79
|
+
thetaRhoPiChiIotaPrepareTheta(i+1, E, A) \
|
|
80
|
+
thetaRhoPiChiIotaPrepareTheta(i+2, A, E) \
|
|
81
|
+
thetaRhoPiChiIotaPrepareTheta(i+3, E, A) \
|
|
82
|
+
thetaRhoPiChiIotaPrepareTheta(i+4, A, E) \
|
|
83
|
+
thetaRhoPiChiIotaPrepareTheta(i+5, E, A) \
|
|
84
|
+
} \
|
|
85
|
+
copyToState(state, A)
|
|
86
|
+
#elif (Unrolling == 4)
|
|
87
|
+
#define rounds \
|
|
88
|
+
prepareTheta \
|
|
89
|
+
for(i=0; i<24; i+=4) { \
|
|
90
|
+
thetaRhoPiChiIotaPrepareTheta(i , A, E) \
|
|
91
|
+
thetaRhoPiChiIotaPrepareTheta(i+1, E, A) \
|
|
92
|
+
thetaRhoPiChiIotaPrepareTheta(i+2, A, E) \
|
|
93
|
+
thetaRhoPiChiIotaPrepareTheta(i+3, E, A) \
|
|
94
|
+
} \
|
|
95
|
+
copyToState(state, A)
|
|
96
|
+
#elif (Unrolling == 3)
|
|
97
|
+
#define rounds \
|
|
98
|
+
prepareTheta \
|
|
99
|
+
for(i=0; i<24; i+=3) { \
|
|
100
|
+
thetaRhoPiChiIotaPrepareTheta(i , A, E) \
|
|
101
|
+
thetaRhoPiChiIotaPrepareTheta(i+1, E, A) \
|
|
102
|
+
thetaRhoPiChiIotaPrepareTheta(i+2, A, E) \
|
|
103
|
+
copyStateVariables(A, E) \
|
|
104
|
+
} \
|
|
105
|
+
copyToState(state, A)
|
|
106
|
+
#elif (Unrolling == 2)
|
|
107
|
+
#define rounds \
|
|
108
|
+
prepareTheta \
|
|
109
|
+
for(i=0; i<24; i+=2) { \
|
|
110
|
+
thetaRhoPiChiIotaPrepareTheta(i , A, E) \
|
|
111
|
+
thetaRhoPiChiIotaPrepareTheta(i+1, E, A) \
|
|
112
|
+
} \
|
|
113
|
+
copyToState(state, A)
|
|
114
|
+
#elif (Unrolling == 1)
|
|
115
|
+
#define rounds \
|
|
116
|
+
prepareTheta \
|
|
117
|
+
for(i=0; i<24; i++) { \
|
|
118
|
+
thetaRhoPiChiIotaPrepareTheta(i , A, E) \
|
|
119
|
+
copyStateVariables(A, E) \
|
|
120
|
+
} \
|
|
121
|
+
copyToState(state, A)
|
|
122
|
+
#else
|
|
123
|
+
#error "Unrolling is not correctly specified!"
|
|
124
|
+
#endif
|
canconfigpython-0.1.0a1.dist-info/Qt-5.7.1-qtbase-src__3rdparty__sha3__KeccakNISTInterface.c.txt
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
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 "KeccakNISTInterface.h"
|
|
16
|
+
#include "KeccakF-1600-interface.h"
|
|
17
|
+
|
|
18
|
+
static HashReturn Init(hashState *state, int hashbitlen)
|
|
19
|
+
{
|
|
20
|
+
switch(hashbitlen) {
|
|
21
|
+
case 0: // Default parameters, arbitrary length output
|
|
22
|
+
InitSponge((spongeState*)state, 1024, 576);
|
|
23
|
+
break;
|
|
24
|
+
case 224:
|
|
25
|
+
InitSponge((spongeState*)state, 1152, 448);
|
|
26
|
+
break;
|
|
27
|
+
case 256:
|
|
28
|
+
InitSponge((spongeState*)state, 1088, 512);
|
|
29
|
+
break;
|
|
30
|
+
case 384:
|
|
31
|
+
InitSponge((spongeState*)state, 832, 768);
|
|
32
|
+
break;
|
|
33
|
+
case 512:
|
|
34
|
+
InitSponge((spongeState*)state, 576, 1024);
|
|
35
|
+
break;
|
|
36
|
+
default:
|
|
37
|
+
return BAD_HASHLEN;
|
|
38
|
+
}
|
|
39
|
+
state->fixedOutputLength = hashbitlen;
|
|
40
|
+
return SUCCESS;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
static HashReturn Update(hashState *state, const BitSequence *data, DataLength databitlen)
|
|
44
|
+
{
|
|
45
|
+
if ((databitlen % 8) == 0)
|
|
46
|
+
return (HashReturn) Absorb((spongeState*)state, data, databitlen);
|
|
47
|
+
else {
|
|
48
|
+
HashReturn ret = (HashReturn) Absorb((spongeState*)state, data, databitlen - (databitlen % 8));
|
|
49
|
+
if (ret == SUCCESS) {
|
|
50
|
+
unsigned char lastByte;
|
|
51
|
+
// Align the last partial byte to the least significant bits
|
|
52
|
+
lastByte = data[databitlen/8] >> (8 - (databitlen % 8));
|
|
53
|
+
return (HashReturn) Absorb((spongeState*)state, &lastByte, databitlen % 8);
|
|
54
|
+
}
|
|
55
|
+
else
|
|
56
|
+
return ret;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
static HashReturn Final(hashState *state, BitSequence *hashval)
|
|
61
|
+
{
|
|
62
|
+
return (HashReturn) Squeeze(state, hashval, state->fixedOutputLength);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
#ifndef QT_BUILDING_QT
|
|
66
|
+
static HashReturn Hash(int hashbitlen, const BitSequence *data, DataLength databitlen, BitSequence *hashval)
|
|
67
|
+
{
|
|
68
|
+
hashState state;
|
|
69
|
+
HashReturn result;
|
|
70
|
+
|
|
71
|
+
if ((hashbitlen != 224) && (hashbitlen != 256) && (hashbitlen != 384) && (hashbitlen != 512))
|
|
72
|
+
return BAD_HASHLEN; // Only the four fixed output lengths available through this API
|
|
73
|
+
result = Init(&state, hashbitlen);
|
|
74
|
+
if (result != SUCCESS)
|
|
75
|
+
return result;
|
|
76
|
+
result = Update(&state, data, databitlen);
|
|
77
|
+
if (result != SUCCESS)
|
|
78
|
+
return result;
|
|
79
|
+
result = Final(&state, hashval);
|
|
80
|
+
return result;
|
|
81
|
+
}
|
|
82
|
+
#endif
|