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
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
/****************************************************************************
|
|
2
|
+
**
|
|
3
|
+
** Copyright (C) 2016 The Qt Company Ltd.
|
|
4
|
+
** Contact: https://www.qt.io/licensing/
|
|
5
|
+
**
|
|
6
|
+
** This file is part of the Qt Toolkit.
|
|
7
|
+
**
|
|
8
|
+
** $QT_BEGIN_LICENSE:LGPL$
|
|
9
|
+
** Commercial License Usage
|
|
10
|
+
** Licensees holding valid commercial Qt licenses may use this file in
|
|
11
|
+
** accordance with the commercial license agreement provided with the
|
|
12
|
+
** Software or, alternatively, in accordance with the terms contained in
|
|
13
|
+
** a written agreement between you and The Qt Company. For licensing terms
|
|
14
|
+
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
15
|
+
** information use the contact form at https://www.qt.io/contact-us.
|
|
16
|
+
**
|
|
17
|
+
** GNU Lesser General Public License Usage
|
|
18
|
+
** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
19
|
+
** General Public License version 3 as published by the Free Software
|
|
20
|
+
** Foundation and appearing in the file LICENSE.LGPL3 included in the
|
|
21
|
+
** packaging of this file. Please review the following information to
|
|
22
|
+
** ensure the GNU Lesser General Public License version 3 requirements
|
|
23
|
+
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
|
|
24
|
+
**
|
|
25
|
+
** GNU General Public License Usage
|
|
26
|
+
** Alternatively, this file may be used under the terms of the GNU
|
|
27
|
+
** General Public License version 2.0 or (at your option) the GNU General
|
|
28
|
+
** Public license version 3 or any later version approved by the KDE Free
|
|
29
|
+
** Qt Foundation. The licenses are as published by the Free Software
|
|
30
|
+
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
|
|
31
|
+
** included in the packaging of this file. Please review the following
|
|
32
|
+
** information to ensure the GNU General Public License requirements will
|
|
33
|
+
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
|
|
34
|
+
** https://www.gnu.org/licenses/gpl-3.0.html.
|
|
35
|
+
**
|
|
36
|
+
** $QT_END_LICENSE$
|
|
37
|
+
**
|
|
38
|
+
****************************************************************************/
|
|
39
|
+
|
|
40
|
+
/*
|
|
41
|
+
Based on the public domain implementation of the SHA-1 algorithm
|
|
42
|
+
Copyright (C) Dominik Reichl <dominik.reichl@t-online.de>
|
|
43
|
+
*/
|
|
44
|
+
#include <QtCore/qendian.h>
|
|
45
|
+
|
|
46
|
+
#ifdef Q_CC_MSVC
|
|
47
|
+
# include <stdlib.h>
|
|
48
|
+
#endif
|
|
49
|
+
|
|
50
|
+
QT_BEGIN_NAMESPACE
|
|
51
|
+
|
|
52
|
+
// Test Vectors (from FIPS PUB 180-1)
|
|
53
|
+
//
|
|
54
|
+
// SHA1("abc") =
|
|
55
|
+
// A9993E36 4706816A BA3E2571 7850C26C 9CD0D89D
|
|
56
|
+
//
|
|
57
|
+
// SHA1("abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq") =
|
|
58
|
+
// 84983E44 1C3BD26E BAAE4AA1 F95129E5 E54670F1
|
|
59
|
+
//
|
|
60
|
+
// SHA1(A million repetitions of "a") =
|
|
61
|
+
// 34AA973C D4C4DAA4 F61EEB2B DBAD2731 6534016F
|
|
62
|
+
//
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
// #define or #undef this, if you want the to wipe all
|
|
66
|
+
// temporary variables after processing
|
|
67
|
+
#define SHA1_WIPE_VARIABLES
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
struct Sha1State
|
|
71
|
+
{
|
|
72
|
+
quint32 h0;
|
|
73
|
+
quint32 h1;
|
|
74
|
+
quint32 h2;
|
|
75
|
+
quint32 h3;
|
|
76
|
+
quint32 h4;
|
|
77
|
+
|
|
78
|
+
quint64 messageSize;
|
|
79
|
+
unsigned char buffer[64];
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
typedef union
|
|
84
|
+
{
|
|
85
|
+
quint8 bytes[64];
|
|
86
|
+
quint32 words[16];
|
|
87
|
+
} Sha1Chunk;
|
|
88
|
+
|
|
89
|
+
static inline quint32 rol32(quint32 value, unsigned int shift)
|
|
90
|
+
{
|
|
91
|
+
#ifdef Q_CC_MSVC
|
|
92
|
+
return _rotl(value, shift);
|
|
93
|
+
#else
|
|
94
|
+
return ((value << shift) | (value >> (32 - shift)));
|
|
95
|
+
#endif
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
static inline quint32 sha1Word(Sha1Chunk *chunk, const uint position)
|
|
99
|
+
{
|
|
100
|
+
return (chunk->words[position & 0xf] = rol32( chunk->words[(position+13) & 0xf]
|
|
101
|
+
^ chunk->words[(position+ 8) & 0xf]
|
|
102
|
+
^ chunk->words[(position+ 2) & 0xf]
|
|
103
|
+
^ chunk->words[(position) & 0xf], 1));
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
static inline void sha1Round0(Sha1Chunk *chunk, const uint position,
|
|
107
|
+
quint32 &v, quint32 &w, quint32 &x, quint32 &y, quint32 &z)
|
|
108
|
+
{
|
|
109
|
+
z += ((( w & (x ^ y)) ^ y) + chunk->words[position] + 0x5A827999 + rol32(v, 5));
|
|
110
|
+
w = rol32(w, 30);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
static inline void sha1Round1(Sha1Chunk *chunk, const uint position,
|
|
114
|
+
quint32 &v, quint32 &w, quint32 &x, quint32 &y, quint32 &z)
|
|
115
|
+
{
|
|
116
|
+
z += ((( w & (x ^ y)) ^ y) + sha1Word(chunk,position) + 0x5A827999 + rol32(v, 5));
|
|
117
|
+
w = rol32(w, 30);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
static inline void sha1Round2(Sha1Chunk *chunk, const uint position,
|
|
121
|
+
quint32 &v, quint32 &w, quint32 &x, quint32 &y, quint32 &z)
|
|
122
|
+
{
|
|
123
|
+
z += (( w ^ x ^ y) + sha1Word(chunk, position) + 0x6ED9EBA1 + rol32(v, 5));
|
|
124
|
+
w = rol32(w, 30);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
static inline void sha1Round3(Sha1Chunk *chunk, const uint position,
|
|
128
|
+
quint32 &v, quint32 &w, quint32 &x, quint32 &y, quint32 &z)
|
|
129
|
+
{
|
|
130
|
+
z += (((( w | x) & y) | (w & x)) + sha1Word(chunk, position) + 0x8F1BBCDC + rol32(v, 5));
|
|
131
|
+
w = rol32(w, 30);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
static inline void sha1Round4(Sha1Chunk *chunk, const uint position,
|
|
135
|
+
quint32 &v, quint32 &w, quint32 &x, quint32 &y, quint32 &z)
|
|
136
|
+
{
|
|
137
|
+
z += ((w ^ x ^ y) + sha1Word(chunk, position) + 0xCA62C1D6 + rol32(v, 5));
|
|
138
|
+
w = rol32(w, 30);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
static inline void sha1ProcessChunk(Sha1State *state, const unsigned char *buffer)
|
|
142
|
+
{
|
|
143
|
+
// Copy state[] to working vars
|
|
144
|
+
quint32 a = state->h0;
|
|
145
|
+
quint32 b = state->h1;
|
|
146
|
+
quint32 c = state->h2;
|
|
147
|
+
quint32 d = state->h3;
|
|
148
|
+
quint32 e = state->h4;
|
|
149
|
+
|
|
150
|
+
quint8 chunkBuffer[64];
|
|
151
|
+
memcpy(chunkBuffer, buffer, 64);
|
|
152
|
+
|
|
153
|
+
Sha1Chunk *chunk = reinterpret_cast<Sha1Chunk*>(&chunkBuffer);
|
|
154
|
+
|
|
155
|
+
for (int i = 0; i < 16; ++i)
|
|
156
|
+
chunk->words[i] = qFromBigEndian(chunk->words[i]);
|
|
157
|
+
|
|
158
|
+
sha1Round0(chunk, 0, a,b,c,d,e); sha1Round0(chunk, 1, e,a,b,c,d); sha1Round0(chunk, 2, d,e,a,b,c); sha1Round0(chunk, 3, c,d,e,a,b);
|
|
159
|
+
sha1Round0(chunk, 4, b,c,d,e,a); sha1Round0(chunk, 5, a,b,c,d,e); sha1Round0(chunk, 6, e,a,b,c,d); sha1Round0(chunk, 7, d,e,a,b,c);
|
|
160
|
+
sha1Round0(chunk, 8, c,d,e,a,b); sha1Round0(chunk, 9, b,c,d,e,a); sha1Round0(chunk, 10, a,b,c,d,e); sha1Round0(chunk, 11, e,a,b,c,d);
|
|
161
|
+
sha1Round0(chunk, 12, d,e,a,b,c); sha1Round0(chunk, 13, c,d,e,a,b); sha1Round0(chunk, 14, b,c,d,e,a); sha1Round0(chunk, 15, a,b,c,d,e);
|
|
162
|
+
sha1Round1(chunk, 16, e,a,b,c,d); sha1Round1(chunk, 17, d,e,a,b,c); sha1Round1(chunk, 18, c,d,e,a,b); sha1Round1(chunk, 19, b,c,d,e,a);
|
|
163
|
+
sha1Round2(chunk, 20, a,b,c,d,e); sha1Round2(chunk, 21, e,a,b,c,d); sha1Round2(chunk, 22, d,e,a,b,c); sha1Round2(chunk, 23, c,d,e,a,b);
|
|
164
|
+
sha1Round2(chunk, 24, b,c,d,e,a); sha1Round2(chunk, 25, a,b,c,d,e); sha1Round2(chunk, 26, e,a,b,c,d); sha1Round2(chunk, 27, d,e,a,b,c);
|
|
165
|
+
sha1Round2(chunk, 28, c,d,e,a,b); sha1Round2(chunk, 29, b,c,d,e,a); sha1Round2(chunk, 30, a,b,c,d,e); sha1Round2(chunk, 31, e,a,b,c,d);
|
|
166
|
+
sha1Round2(chunk, 32, d,e,a,b,c); sha1Round2(chunk, 33, c,d,e,a,b); sha1Round2(chunk, 34, b,c,d,e,a); sha1Round2(chunk, 35, a,b,c,d,e);
|
|
167
|
+
sha1Round2(chunk, 36, e,a,b,c,d); sha1Round2(chunk, 37, d,e,a,b,c); sha1Round2(chunk, 38, c,d,e,a,b); sha1Round2(chunk, 39, b,c,d,e,a);
|
|
168
|
+
sha1Round3(chunk, 40, a,b,c,d,e); sha1Round3(chunk, 41, e,a,b,c,d); sha1Round3(chunk, 42, d,e,a,b,c); sha1Round3(chunk, 43, c,d,e,a,b);
|
|
169
|
+
sha1Round3(chunk, 44, b,c,d,e,a); sha1Round3(chunk, 45, a,b,c,d,e); sha1Round3(chunk, 46, e,a,b,c,d); sha1Round3(chunk, 47, d,e,a,b,c);
|
|
170
|
+
sha1Round3(chunk, 48, c,d,e,a,b); sha1Round3(chunk, 49, b,c,d,e,a); sha1Round3(chunk, 50, a,b,c,d,e); sha1Round3(chunk, 51, e,a,b,c,d);
|
|
171
|
+
sha1Round3(chunk, 52, d,e,a,b,c); sha1Round3(chunk, 53, c,d,e,a,b); sha1Round3(chunk, 54, b,c,d,e,a); sha1Round3(chunk, 55, a,b,c,d,e);
|
|
172
|
+
sha1Round3(chunk, 56, e,a,b,c,d); sha1Round3(chunk, 57, d,e,a,b,c); sha1Round3(chunk, 58, c,d,e,a,b); sha1Round3(chunk, 59, b,c,d,e,a);
|
|
173
|
+
sha1Round4(chunk, 60, a,b,c,d,e); sha1Round4(chunk, 61, e,a,b,c,d); sha1Round4(chunk, 62, d,e,a,b,c); sha1Round4(chunk, 63, c,d,e,a,b);
|
|
174
|
+
sha1Round4(chunk, 64, b,c,d,e,a); sha1Round4(chunk, 65, a,b,c,d,e); sha1Round4(chunk, 66, e,a,b,c,d); sha1Round4(chunk, 67, d,e,a,b,c);
|
|
175
|
+
sha1Round4(chunk, 68, c,d,e,a,b); sha1Round4(chunk, 69, b,c,d,e,a); sha1Round4(chunk, 70, a,b,c,d,e); sha1Round4(chunk, 71, e,a,b,c,d);
|
|
176
|
+
sha1Round4(chunk, 72, d,e,a,b,c); sha1Round4(chunk, 73, c,d,e,a,b); sha1Round4(chunk, 74, b,c,d,e,a); sha1Round4(chunk, 75, a,b,c,d,e);
|
|
177
|
+
sha1Round4(chunk, 76, e,a,b,c,d); sha1Round4(chunk, 77, d,e,a,b,c); sha1Round4(chunk, 78, c,d,e,a,b); sha1Round4(chunk, 79, b,c,d,e,a);
|
|
178
|
+
|
|
179
|
+
// Add the working vars back into state
|
|
180
|
+
state->h0 += a;
|
|
181
|
+
state->h1 += b;
|
|
182
|
+
state->h2 += c;
|
|
183
|
+
state->h3 += d;
|
|
184
|
+
state->h4 += e;
|
|
185
|
+
|
|
186
|
+
// Wipe variables
|
|
187
|
+
#ifdef SHA1_WIPE_VARIABLES
|
|
188
|
+
a = b = c = d = e = 0;
|
|
189
|
+
memset(chunkBuffer, 0, 64);
|
|
190
|
+
#endif
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
static inline void sha1InitState(Sha1State *state)
|
|
194
|
+
{
|
|
195
|
+
state->h0 = 0x67452301;
|
|
196
|
+
state->h1 = 0xEFCDAB89;
|
|
197
|
+
state->h2 = 0x98BADCFE;
|
|
198
|
+
state->h3 = 0x10325476;
|
|
199
|
+
state->h4 = 0xC3D2E1F0;
|
|
200
|
+
|
|
201
|
+
state->messageSize = 0;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
static inline void sha1Update(Sha1State *state, const unsigned char *data, qint64 len)
|
|
205
|
+
{
|
|
206
|
+
quint32 rest = static_cast<quint32>(state->messageSize & Q_UINT64_C(63));
|
|
207
|
+
|
|
208
|
+
quint64 availableData = static_cast<quint64>(len) + static_cast<quint64>(rest);
|
|
209
|
+
state->messageSize += len;
|
|
210
|
+
|
|
211
|
+
if (availableData < Q_UINT64_C(64)) {
|
|
212
|
+
memcpy(&state->buffer[rest], &data[0], len);
|
|
213
|
+
|
|
214
|
+
} else {
|
|
215
|
+
qint64 i = static_cast<qint64>(64 - rest);
|
|
216
|
+
memcpy(&state->buffer[rest], &data[0], static_cast<qint32>(i));
|
|
217
|
+
sha1ProcessChunk(state, state->buffer);
|
|
218
|
+
|
|
219
|
+
qint64 lastI = len - ((len + rest) & Q_INT64_C(63));
|
|
220
|
+
for( ; i < lastI; i += 64)
|
|
221
|
+
sha1ProcessChunk(state, &data[i]);
|
|
222
|
+
|
|
223
|
+
memcpy(&state->buffer[0], &data[i], len - i);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
static inline void sha1FinalizeState(Sha1State *state)
|
|
228
|
+
{
|
|
229
|
+
quint64 messageSize = state->messageSize;
|
|
230
|
+
unsigned char sizeInBits[8];
|
|
231
|
+
qToBigEndian(messageSize << 3, sizeInBits);
|
|
232
|
+
|
|
233
|
+
sha1Update(state, (const unsigned char *)"\200", 1);
|
|
234
|
+
|
|
235
|
+
unsigned char zero[64];
|
|
236
|
+
memset(zero, 0, 64);
|
|
237
|
+
if (static_cast<int>(messageSize & 63) > 56 - 1) {
|
|
238
|
+
sha1Update(state, zero, 64 - 1 - static_cast<int>(messageSize & 63));
|
|
239
|
+
sha1Update(state, zero, 64 - 8);
|
|
240
|
+
} else {
|
|
241
|
+
sha1Update(state, zero, 64 - 1 - 8 - static_cast<int>(messageSize & 63));
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
sha1Update(state, sizeInBits, 8);
|
|
245
|
+
#ifdef SHA1_WIPE_VARIABLES
|
|
246
|
+
memset(state->buffer, 0, 64);
|
|
247
|
+
memset(zero, 0, 64);
|
|
248
|
+
state->messageSize = 0;
|
|
249
|
+
#endif
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
static inline void sha1ToHash(Sha1State *state, unsigned char* buffer)
|
|
253
|
+
{
|
|
254
|
+
qToBigEndian(state->h0, buffer);
|
|
255
|
+
qToBigEndian(state->h1, buffer + 4);
|
|
256
|
+
qToBigEndian(state->h2, buffer + 8);
|
|
257
|
+
qToBigEndian(state->h3, buffer + 12);
|
|
258
|
+
qToBigEndian(state->h4, buffer + 16);
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
QT_END_NAMESPACE
|