cchecksum 0.0.4__tar.gz → 0.0.6__tar.gz
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.
Potentially problematic release.
This version of cchecksum might be problematic. Click here for more details.
- {cchecksum-0.0.4/cchecksum.egg-info → cchecksum-0.0.6}/PKG-INFO +9 -2
- {cchecksum-0.0.4 → cchecksum-0.0.6}/cchecksum/_checksum.c +6 -6
- {cchecksum-0.0.4 → cchecksum-0.0.6}/cchecksum/checksum.py +36 -8
- {cchecksum-0.0.4 → cchecksum-0.0.6/cchecksum.egg-info}/PKG-INFO +9 -2
- {cchecksum-0.0.4 → cchecksum-0.0.6}/.github/workflows/black.yaml +0 -0
- {cchecksum-0.0.4 → cchecksum-0.0.6}/.github/workflows/deploy-docs.yaml +0 -0
- {cchecksum-0.0.4 → cchecksum-0.0.6}/.github/workflows/pytest.yaml +0 -0
- {cchecksum-0.0.4 → cchecksum-0.0.6}/.github/workflows/release.yaml +0 -0
- {cchecksum-0.0.4 → cchecksum-0.0.6}/.gitignore +0 -0
- {cchecksum-0.0.4 → cchecksum-0.0.6}/LICENSE +0 -0
- {cchecksum-0.0.4 → cchecksum-0.0.6}/Makefile +0 -0
- {cchecksum-0.0.4 → cchecksum-0.0.6}/README.md +0 -0
- {cchecksum-0.0.4 → cchecksum-0.0.6}/cchecksum/__init__.py +0 -0
- {cchecksum-0.0.4 → cchecksum-0.0.6}/cchecksum/_cchecksum.pyi +0 -0
- {cchecksum-0.0.4 → cchecksum-0.0.6}/cchecksum/_checksum.pyx +0 -0
- {cchecksum-0.0.4 → cchecksum-0.0.6}/cchecksum/py.typed +0 -0
- {cchecksum-0.0.4 → cchecksum-0.0.6}/cchecksum.egg-info/SOURCES.txt +0 -0
- {cchecksum-0.0.4 → cchecksum-0.0.6}/cchecksum.egg-info/dependency_links.txt +0 -0
- {cchecksum-0.0.4 → cchecksum-0.0.6}/cchecksum.egg-info/not-zip-safe +0 -0
- {cchecksum-0.0.4 → cchecksum-0.0.6}/cchecksum.egg-info/requires.txt +0 -0
- {cchecksum-0.0.4 → cchecksum-0.0.6}/cchecksum.egg-info/top_level.txt +0 -0
- {cchecksum-0.0.4 → cchecksum-0.0.6}/docs/Makefile +0 -0
- {cchecksum-0.0.4 → cchecksum-0.0.6}/docs/_build/html/_static/alabaster.css +0 -0
- {cchecksum-0.0.4 → cchecksum-0.0.6}/docs/_build/html/_static/basic.css +0 -0
- {cchecksum-0.0.4 → cchecksum-0.0.6}/docs/_build/html/_static/custom.css +0 -0
- {cchecksum-0.0.4 → cchecksum-0.0.6}/docs/_build/html/_static/doctools.js +0 -0
- {cchecksum-0.0.4 → cchecksum-0.0.6}/docs/_build/html/_static/documentation_options.js +0 -0
- {cchecksum-0.0.4 → cchecksum-0.0.6}/docs/_build/html/_static/file.png +0 -0
- {cchecksum-0.0.4 → cchecksum-0.0.6}/docs/_build/html/_static/language_data.js +0 -0
- {cchecksum-0.0.4 → cchecksum-0.0.6}/docs/_build/html/_static/minus.png +0 -0
- {cchecksum-0.0.4 → cchecksum-0.0.6}/docs/_build/html/_static/plus.png +0 -0
- {cchecksum-0.0.4 → cchecksum-0.0.6}/docs/_build/html/_static/pygments.css +0 -0
- {cchecksum-0.0.4 → cchecksum-0.0.6}/docs/_build/html/_static/searchtools.js +0 -0
- {cchecksum-0.0.4 → cchecksum-0.0.6}/docs/_build/html/_static/sphinx_highlight.js +0 -0
- {cchecksum-0.0.4 → cchecksum-0.0.6}/docs/conf.py +0 -0
- {cchecksum-0.0.4 → cchecksum-0.0.6}/docs/index.rst +0 -0
- {cchecksum-0.0.4 → cchecksum-0.0.6}/docs/make.bat +0 -0
- {cchecksum-0.0.4 → cchecksum-0.0.6}/pyproject.toml +0 -0
- {cchecksum-0.0.4 → cchecksum-0.0.6}/requirements.txt +0 -0
- {cchecksum-0.0.4 → cchecksum-0.0.6}/setup.cfg +0 -0
- {cchecksum-0.0.4 → cchecksum-0.0.6}/setup.py +0 -0
- {cchecksum-0.0.4 → cchecksum-0.0.6}/test_checksum.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
2
|
Name: cchecksum
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.6
|
|
4
4
|
Summary: A ~2x faster drop-in replacement for eth_utils.to_checksum_address. Raises the exact same Exceptions. Implemented in C.
|
|
5
5
|
Home-page: https://github.com/BobTheBuidler/cchecksum
|
|
6
6
|
Author: BobTheBuidler
|
|
@@ -11,3 +11,10 @@ License-File: LICENSE
|
|
|
11
11
|
Requires-Dist: eth-typing
|
|
12
12
|
Requires-Dist: eth-utils
|
|
13
13
|
Requires-Dist: pysha3<2.0.0,>=1.0.0; python_version < "3.9"
|
|
14
|
+
Dynamic: author
|
|
15
|
+
Dynamic: author-email
|
|
16
|
+
Dynamic: home-page
|
|
17
|
+
Dynamic: license
|
|
18
|
+
Dynamic: requires-dist
|
|
19
|
+
Dynamic: requires-python
|
|
20
|
+
Dynamic: summary
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* Generated by Cython 3.0.
|
|
1
|
+
/* Generated by Cython 3.0.12 */
|
|
2
2
|
|
|
3
3
|
/* BEGIN: Cython Metadata
|
|
4
4
|
{
|
|
@@ -36,10 +36,10 @@ END: Cython Metadata */
|
|
|
36
36
|
#else
|
|
37
37
|
#define __PYX_EXTRA_ABI_MODULE_NAME ""
|
|
38
38
|
#endif
|
|
39
|
-
#define CYTHON_ABI "
|
|
39
|
+
#define CYTHON_ABI "3_0_12" __PYX_EXTRA_ABI_MODULE_NAME
|
|
40
40
|
#define __PYX_ABI_MODULE_NAME "_cython_" CYTHON_ABI
|
|
41
41
|
#define __PYX_TYPE_MODULE_PREFIX __PYX_ABI_MODULE_NAME "."
|
|
42
|
-
#define CYTHON_HEX_VERSION
|
|
42
|
+
#define CYTHON_HEX_VERSION 0x03000CF0
|
|
43
43
|
#define CYTHON_FUTURE_DIVISION 1
|
|
44
44
|
#include <stddef.h>
|
|
45
45
|
#ifndef offsetof
|
|
@@ -1935,7 +1935,7 @@ static PyObject *__Pyx_GetBuiltinName(PyObject *name);
|
|
|
1935
1935
|
#include "compile.h"
|
|
1936
1936
|
#include "frameobject.h"
|
|
1937
1937
|
#include "traceback.h"
|
|
1938
|
-
#if PY_VERSION_HEX >= 0x030b00a6
|
|
1938
|
+
#if PY_VERSION_HEX >= 0x030b00a6 && !defined(PYPY_VERSION)
|
|
1939
1939
|
#ifndef Py_BUILD_CORE
|
|
1940
1940
|
#define Py_BUILD_CORE 1
|
|
1941
1941
|
#endif
|
|
@@ -2279,7 +2279,7 @@ static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args,
|
|
|
2279
2279
|
#if !CYTHON_VECTORCALL
|
|
2280
2280
|
#if PY_VERSION_HEX >= 0x03080000
|
|
2281
2281
|
#include "frameobject.h"
|
|
2282
|
-
#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API
|
|
2282
|
+
#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API && !defined(PYPY_VERSION)
|
|
2283
2283
|
#ifndef Py_BUILD_CORE
|
|
2284
2284
|
#define Py_BUILD_CORE 1
|
|
2285
2285
|
#endif
|
|
@@ -25253,7 +25253,7 @@ static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
|
|
|
25253
25253
|
#include "compile.h"
|
|
25254
25254
|
#include "frameobject.h"
|
|
25255
25255
|
#include "traceback.h"
|
|
25256
|
-
#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API
|
|
25256
|
+
#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API && !defined(PYPY_VERSION)
|
|
25257
25257
|
#ifndef Py_BUILD_CORE
|
|
25258
25258
|
#define Py_BUILD_CORE 1
|
|
25259
25259
|
#endif
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
from typing import Union
|
|
1
|
+
from binascii import hexlify
|
|
2
|
+
from typing import Optional, Union
|
|
3
3
|
|
|
4
|
-
from
|
|
5
|
-
from
|
|
4
|
+
from eth_hash.auto import keccak
|
|
5
|
+
from eth_typing import AnyAddress, ChecksumAddress, HexAddress, HexStr, Primitives
|
|
6
|
+
from eth_utils import add_0x_prefix, encode_hex, hexstr_if_str
|
|
6
7
|
from eth_utils.address import _HEX_ADDRESS_REGEXP
|
|
7
8
|
|
|
8
9
|
from cchecksum._checksum import cchecksum
|
|
@@ -39,8 +40,8 @@ def to_checksum_address(value: Union[AnyAddress, str, bytes]) -> ChecksumAddress
|
|
|
39
40
|
- :func:`to_normalized_address` for converting to a normalized address before checksumming.
|
|
40
41
|
"""
|
|
41
42
|
norm_address_no_0x = to_normalized_address(value)[2:]
|
|
42
|
-
address_hash = keccak(
|
|
43
|
-
address_hash_hex_no_0x =
|
|
43
|
+
address_hash = bytes(keccak(norm_address_no_0x.encode("utf-8")))
|
|
44
|
+
address_hash_hex_no_0x = hexlify(address_hash).decode("ascii")
|
|
44
45
|
return cchecksum(norm_address_no_0x, address_hash_hex_no_0x)
|
|
45
46
|
|
|
46
47
|
|
|
@@ -50,12 +51,12 @@ def to_normalized_address(value: Union[AnyAddress, str, bytes]) -> HexAddress:
|
|
|
50
51
|
|
|
51
52
|
This function ensures that the address is in a consistent lowercase hexadecimal
|
|
52
53
|
format, which is useful for further processing or validation. It uses
|
|
53
|
-
:func:`eth_utils.hexstr_if_str` and :func:`
|
|
54
|
+
:func:`eth_utils.hexstr_if_str` and :func:`to_hex` to convert the input
|
|
54
55
|
to a hexadecimal string.
|
|
55
56
|
|
|
56
57
|
Args:
|
|
57
58
|
value: The address to be normalized. It can be in any format supported by
|
|
58
|
-
:func:`
|
|
59
|
+
:func:`to_hex`.
|
|
59
60
|
|
|
60
61
|
Raises:
|
|
61
62
|
ValueError: If the input address is not in a recognized format.
|
|
@@ -109,3 +110,30 @@ def is_address(value: str) -> bool:
|
|
|
109
110
|
- :func:`eth_utils.is_address` for the standard implementation.
|
|
110
111
|
"""
|
|
111
112
|
return _HEX_ADDRESS_REGEXP.fullmatch(value) is not None
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
BytesLike = Union[Primitives, bytearray, memoryview]
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
def to_hex(
|
|
119
|
+
address_bytes: Optional[BytesLike] = None,
|
|
120
|
+
*,
|
|
121
|
+
hexstr: Optional[HexStr] = None,
|
|
122
|
+
) -> HexStr:
|
|
123
|
+
"""
|
|
124
|
+
Auto converts any supported value into its hex representation.
|
|
125
|
+
Trims leading zeros, as defined in:
|
|
126
|
+
https://github.com/ethereum/wiki/wiki/JSON-RPC#hex-value-encoding
|
|
127
|
+
"""
|
|
128
|
+
if hexstr is not None:
|
|
129
|
+
return add_0x_prefix(hexstr.lower())
|
|
130
|
+
|
|
131
|
+
if isinstance(address_bytes, (bytes, bytearray)):
|
|
132
|
+
return encode_hex(address_bytes)
|
|
133
|
+
|
|
134
|
+
if isinstance(address_bytes, memoryview):
|
|
135
|
+
return encode_hex(bytes(address_bytes))
|
|
136
|
+
|
|
137
|
+
raise TypeError(
|
|
138
|
+
f"Unsupported type: '{repr(type(address_bytes))}'. Must be one of: bytes or bytearray."
|
|
139
|
+
)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
2
|
Name: cchecksum
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.6
|
|
4
4
|
Summary: A ~2x faster drop-in replacement for eth_utils.to_checksum_address. Raises the exact same Exceptions. Implemented in C.
|
|
5
5
|
Home-page: https://github.com/BobTheBuidler/cchecksum
|
|
6
6
|
Author: BobTheBuidler
|
|
@@ -11,3 +11,10 @@ License-File: LICENSE
|
|
|
11
11
|
Requires-Dist: eth-typing
|
|
12
12
|
Requires-Dist: eth-utils
|
|
13
13
|
Requires-Dist: pysha3<2.0.0,>=1.0.0; python_version < "3.9"
|
|
14
|
+
Dynamic: author
|
|
15
|
+
Dynamic: author-email
|
|
16
|
+
Dynamic: home-page
|
|
17
|
+
Dynamic: license
|
|
18
|
+
Dynamic: requires-dist
|
|
19
|
+
Dynamic: requires-python
|
|
20
|
+
Dynamic: summary
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|