cchecksum 0.0.8__tar.gz → 0.0.10__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.

Files changed (44) hide show
  1. {cchecksum-0.0.8 → cchecksum-0.0.10}/.github/workflows/deploy-docs.yaml +6 -3
  2. {cchecksum-0.0.8/cchecksum.egg-info → cchecksum-0.0.10}/PKG-INFO +1 -1
  3. {cchecksum-0.0.8 → cchecksum-0.0.10}/cchecksum/_checksum.c +94 -145
  4. cchecksum-0.0.10/cchecksum/_checksum.pyi +3 -0
  5. {cchecksum-0.0.8 → cchecksum-0.0.10}/cchecksum/_checksum.pyx +8 -9
  6. {cchecksum-0.0.8 → cchecksum-0.0.10}/cchecksum/checksum.py +1 -2
  7. {cchecksum-0.0.8 → cchecksum-0.0.10/cchecksum.egg-info}/PKG-INFO +1 -1
  8. {cchecksum-0.0.8 → cchecksum-0.0.10}/docs/conf.py +1 -0
  9. cchecksum-0.0.8/cchecksum/_checksum.pyi +0 -3
  10. {cchecksum-0.0.8 → cchecksum-0.0.10}/.github/workflows/black.yaml +0 -0
  11. {cchecksum-0.0.8 → cchecksum-0.0.10}/.github/workflows/pytest.yaml +0 -0
  12. {cchecksum-0.0.8 → cchecksum-0.0.10}/.github/workflows/release.yaml +0 -0
  13. {cchecksum-0.0.8 → cchecksum-0.0.10}/.gitignore +0 -0
  14. {cchecksum-0.0.8 → cchecksum-0.0.10}/LICENSE +0 -0
  15. {cchecksum-0.0.8 → cchecksum-0.0.10}/Makefile +0 -0
  16. {cchecksum-0.0.8 → cchecksum-0.0.10}/README.md +0 -0
  17. {cchecksum-0.0.8 → cchecksum-0.0.10}/cchecksum/__init__.py +0 -0
  18. {cchecksum-0.0.8 → cchecksum-0.0.10}/cchecksum/checksum.pyi +0 -0
  19. {cchecksum-0.0.8 → cchecksum-0.0.10}/cchecksum/py.typed +0 -0
  20. {cchecksum-0.0.8 → cchecksum-0.0.10}/cchecksum.egg-info/SOURCES.txt +0 -0
  21. {cchecksum-0.0.8 → cchecksum-0.0.10}/cchecksum.egg-info/dependency_links.txt +0 -0
  22. {cchecksum-0.0.8 → cchecksum-0.0.10}/cchecksum.egg-info/not-zip-safe +0 -0
  23. {cchecksum-0.0.8 → cchecksum-0.0.10}/cchecksum.egg-info/requires.txt +0 -0
  24. {cchecksum-0.0.8 → cchecksum-0.0.10}/cchecksum.egg-info/top_level.txt +0 -0
  25. {cchecksum-0.0.8 → cchecksum-0.0.10}/docs/Makefile +0 -0
  26. {cchecksum-0.0.8 → cchecksum-0.0.10}/docs/_build/html/_static/alabaster.css +0 -0
  27. {cchecksum-0.0.8 → cchecksum-0.0.10}/docs/_build/html/_static/basic.css +0 -0
  28. {cchecksum-0.0.8 → cchecksum-0.0.10}/docs/_build/html/_static/custom.css +0 -0
  29. {cchecksum-0.0.8 → cchecksum-0.0.10}/docs/_build/html/_static/doctools.js +0 -0
  30. {cchecksum-0.0.8 → cchecksum-0.0.10}/docs/_build/html/_static/documentation_options.js +0 -0
  31. {cchecksum-0.0.8 → cchecksum-0.0.10}/docs/_build/html/_static/file.png +0 -0
  32. {cchecksum-0.0.8 → cchecksum-0.0.10}/docs/_build/html/_static/language_data.js +0 -0
  33. {cchecksum-0.0.8 → cchecksum-0.0.10}/docs/_build/html/_static/minus.png +0 -0
  34. {cchecksum-0.0.8 → cchecksum-0.0.10}/docs/_build/html/_static/plus.png +0 -0
  35. {cchecksum-0.0.8 → cchecksum-0.0.10}/docs/_build/html/_static/pygments.css +0 -0
  36. {cchecksum-0.0.8 → cchecksum-0.0.10}/docs/_build/html/_static/searchtools.js +0 -0
  37. {cchecksum-0.0.8 → cchecksum-0.0.10}/docs/_build/html/_static/sphinx_highlight.js +0 -0
  38. {cchecksum-0.0.8 → cchecksum-0.0.10}/docs/index.rst +0 -0
  39. {cchecksum-0.0.8 → cchecksum-0.0.10}/docs/make.bat +0 -0
  40. {cchecksum-0.0.8 → cchecksum-0.0.10}/pyproject.toml +0 -0
  41. {cchecksum-0.0.8 → cchecksum-0.0.10}/requirements.txt +0 -0
  42. {cchecksum-0.0.8 → cchecksum-0.0.10}/setup.cfg +0 -0
  43. {cchecksum-0.0.8 → cchecksum-0.0.10}/setup.py +0 -0
  44. {cchecksum-0.0.8 → cchecksum-0.0.10}/test_checksum.py +0 -0
@@ -5,6 +5,9 @@ on:
5
5
  branches:
6
6
  - master
7
7
 
8
+ concurrency:
9
+ group: ${{ github.workflow }}-${{ github.ref }}
10
+ cancel-in-progress: true
8
11
 
9
12
  # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
10
13
  permissions:
@@ -16,13 +19,12 @@ permissions:
16
19
  jobs:
17
20
  build-and-deploy:
18
21
  runs-on: ubuntu-latest
19
-
20
- environment:
21
- name: github-pages
22
22
 
23
23
  steps:
24
24
  - name: Check out code
25
25
  uses: actions/checkout@v2
26
+ with:
27
+ persist-credentials: false
26
28
 
27
29
  - name: Set up Python
28
30
  uses: actions/setup-python@v2
@@ -55,6 +57,7 @@ jobs:
55
57
  uses: actions/checkout@v4
56
58
  with:
57
59
  ref: gh-pages
60
+ persist-credentials: false
58
61
 
59
62
  - name: Setup Pages
60
63
  uses: actions/configure-pages@v4
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cchecksum
3
- Version: 0.0.8
3
+ Version: 0.0.10
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
@@ -2599,32 +2599,12 @@ static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16BE(const char *s, Py_s
2599
2599
  return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
2600
2600
  }
2601
2601
 
2602
- /* decode_c_bytes.proto */
2603
- static CYTHON_INLINE PyObject* __Pyx_decode_c_bytes(
2604
- const char* cstring, Py_ssize_t length, Py_ssize_t start, Py_ssize_t stop,
2602
+ /* decode_c_string.proto */
2603
+ static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
2604
+ const char* cstring, Py_ssize_t start, Py_ssize_t stop,
2605
2605
  const char* encoding, const char* errors,
2606
2606
  PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors));
2607
2607
 
2608
- /* decode_bytes.proto */
2609
- static CYTHON_INLINE PyObject* __Pyx_decode_bytes(
2610
- PyObject* string, Py_ssize_t start, Py_ssize_t stop,
2611
- const char* encoding, const char* errors,
2612
- PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) {
2613
- char* as_c_string;
2614
- Py_ssize_t size;
2615
- #if CYTHON_ASSUME_SAFE_MACROS
2616
- as_c_string = PyBytes_AS_STRING(string);
2617
- size = PyBytes_GET_SIZE(string);
2618
- #else
2619
- if (PyBytes_AsStringAndSize(string, &as_c_string, &size) < 0) {
2620
- return NULL;
2621
- }
2622
- #endif
2623
- return __Pyx_decode_c_bytes(
2624
- as_c_string, size,
2625
- start, stop, encoding, errors, decode_func);
2626
- }
2627
-
2628
2608
  /* PyObject_GenericGetAttrNoDict.proto */
2629
2609
  #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
2630
2610
  static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name);
@@ -2903,7 +2883,7 @@ static int __Pyx_ValidateAndInit_memviewslice(
2903
2883
  PyObject *original_obj);
2904
2884
 
2905
2885
  /* ObjectToMemviewSlice.proto */
2906
- static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dc_unsigned_char(PyObject *, int writable_flag);
2886
+ static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dc_unsigned_char__const__(PyObject *, int writable_flag);
2907
2887
 
2908
2888
  /* MemviewSliceCopyTemplate.proto */
2909
2889
  static __Pyx_memviewslice
@@ -3034,7 +3014,7 @@ static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *, int, size
3034
3014
  static void __pyx_memoryview__slice_assign_scalar(char *, Py_ssize_t *, Py_ssize_t *, int, size_t, void *); /*proto*/
3035
3015
  static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *, PyObject *); /*proto*/
3036
3016
  /* #### Code section: typeinfo ### */
3037
- static __Pyx_TypeInfo __Pyx_TypeInfo_unsigned_char = { "unsigned char", NULL, sizeof(unsigned char), { 0 }, 0, __PYX_IS_UNSIGNED(unsigned char) ? 'U' : 'I', __PYX_IS_UNSIGNED(unsigned char), 0 };
3017
+ static __Pyx_TypeInfo __Pyx_TypeInfo_unsigned_char__const__ = { "const unsigned char", NULL, sizeof(unsigned char const ), { 0 }, 0, __PYX_IS_UNSIGNED(unsigned char const ) ? 'U' : 'I', __PYX_IS_UNSIGNED(unsigned char const ), 0 };
3038
3018
  /* #### Code section: before_global_var ### */
3039
3019
  #define __Pyx_MODULE_NAME "cchecksum._checksum"
3040
3020
  extern int __pyx_module_is_main_cchecksum___checksum;
@@ -3137,7 +3117,6 @@ static const char __pyx_k_stringsource[] = "<stringsource>";
3137
3117
  static const char __pyx_k_version_info[] = "version_info";
3138
3118
  static const char __pyx_k_OverflowError[] = "OverflowError";
3139
3119
  static const char __pyx_k_class_getitem[] = "__class_getitem__";
3140
- static const char __pyx_k_hash_bytes_mv[] = "hash_bytes_mv";
3141
3120
  static const char __pyx_k_reduce_cython[] = "__reduce_cython__";
3142
3121
  static const char __pyx_k_AssertionError[] = "AssertionError";
3143
3122
  static const char __pyx_k_View_MemoryView[] = "View.MemoryView";
@@ -3169,7 +3148,7 @@ static const char __pyx_k_Step_may_not_be_zero_axis_d[] = "Step may not be zero
3169
3148
  static const char __pyx_k_itemsize_0_for_cython_array[] = "itemsize <= 0 for cython.array";
3170
3149
  static const char __pyx_k_unable_to_allocate_array_data[] = "unable to allocate array data.";
3171
3150
  static const char __pyx_k_strided_and_direct_or_indirect[] = "<strided and direct or indirect>";
3172
- static const char __pyx_k_Computes_the_checksummed_versio[] = "\n Computes the checksummed version of an Ethereum address.\n\n This function takes a normalized Ethereum address (without the '0x' prefix) and its corresponding\n hash (also without the '0x' prefix) and returns the checksummed address as per the Ethereum\n Improvement Proposal 55 (EIP-55).\n\n Args:\n norm_address_no_0x (str): The normalized Ethereum address without the '0x' prefix.\n address_hash_hex_no_0x (str): The hash of the address, also without the '0x' prefix.\n\n Returns:\n The checksummed Ethereum address with the '0x' prefix.\n\n Examples:\n >>> cchecksum(\"b47e3cd837ddf8e4c57f05d70ab865de6e193bbb\", \"abcdef1234567890abcdef1234567890abcdef12\")\n '0xB47E3Cd837DdF8E4C57F05D70Ab865De6E193BbB'\n\n >>> cchecksum(\"0000000000000000000000000000000000000000\", \"1234567890abcdef1234567890abcdef12345678\")\n '0x0000000000000000000000000000000000000000'\n\n See Also:\n - :func:`eth_utils.to_checksum_address`: A utility function for converting addresses to their checksummed form.\n ";
3151
+ static const char __pyx_k_Computes_the_checksummed_versio[] = "\n Computes the checksummed version of an Ethereum address.\n\n This function takes a normalized Ethereum address (without the '0x' prefix) and its corresponding\n hash (also without the '0x' prefix) and returns the checksummed address as per the Ethereum\n Improvement Proposal 55 (EIP-55).\n\n Args:\n norm_address_no_0x (str): The normalized Ethereum address without the '0x' prefix.\n address_hash_hex_no_0x (bytes): The hash of the address, also without the '0x' prefix.\n\n Returns:\n The checksummed Ethereum address with the '0x' prefix.\n\n Examples:\n >>> cchecksum(\"b47e3cd837ddf8e4c57f05d70ab865de6e193bbb\", \"abcdef1234567890abcdef1234567890abcdef12\")\n '0xB47E3Cd837DdF8E4C57F05D70Ab865De6E193BbB'\n\n >>> cchecksum(\"0000000000000000000000000000000000000000\", \"1234567890abcdef1234567890abcdef12345678\")\n '0x0000000000000000000000000000000000000000'\n\n See Also:\n - :func:`eth_utils.to_checksum_address`: A utility function for converting addresses to their checksummed form.\n ";
3173
3152
  static const char __pyx_k_All_dimensions_preceding_dimensi[] = "All dimensions preceding dimension %d must be indexed and not sliced";
3174
3153
  static const char __pyx_k_Buffer_view_does_not_expose_stri[] = "Buffer view does not expose strides";
3175
3154
  static const char __pyx_k_Can_only_create_a_buffer_that_is[] = "Can only create a buffer that is contiguous in memory.";
@@ -3227,7 +3206,7 @@ static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewsl
3227
3206
  static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
3228
3207
  static PyObject *__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
3229
3208
  static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
3230
- static PyObject *__pyx_pf_9cchecksum_9_checksum_cchecksum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_norm_address_no_0x, PyObject *__pyx_v_address_hash_hex_no_0x); /* proto */
3209
+ static PyObject *__pyx_pf_9cchecksum_9_checksum_cchecksum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_norm_address_no_0x, __Pyx_memviewslice __pyx_v_address_hash_hex_no_0x); /* proto */
3231
3210
  static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
3232
3211
  static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
3233
3212
  static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
@@ -3345,7 +3324,6 @@ typedef struct {
3345
3324
  PyObject *__pyx_n_s_getstate;
3346
3325
  PyObject *__pyx_kp_u_got;
3347
3326
  PyObject *__pyx_kp_u_got_differing_extents_in_dimensi;
3348
- PyObject *__pyx_n_s_hash_bytes_mv;
3349
3327
  PyObject *__pyx_n_s_i;
3350
3328
  PyObject *__pyx_n_s_id;
3351
3329
  PyObject *__pyx_n_s_import;
@@ -3553,7 +3531,6 @@ static int __pyx_m_clear(PyObject *m) {
3553
3531
  Py_CLEAR(clear_module_state->__pyx_n_s_getstate);
3554
3532
  Py_CLEAR(clear_module_state->__pyx_kp_u_got);
3555
3533
  Py_CLEAR(clear_module_state->__pyx_kp_u_got_differing_extents_in_dimensi);
3556
- Py_CLEAR(clear_module_state->__pyx_n_s_hash_bytes_mv);
3557
3534
  Py_CLEAR(clear_module_state->__pyx_n_s_i);
3558
3535
  Py_CLEAR(clear_module_state->__pyx_n_s_id);
3559
3536
  Py_CLEAR(clear_module_state->__pyx_n_s_import);
@@ -3739,7 +3716,6 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) {
3739
3716
  Py_VISIT(traverse_module_state->__pyx_n_s_getstate);
3740
3717
  Py_VISIT(traverse_module_state->__pyx_kp_u_got);
3741
3718
  Py_VISIT(traverse_module_state->__pyx_kp_u_got_differing_extents_in_dimensi);
3742
- Py_VISIT(traverse_module_state->__pyx_n_s_hash_bytes_mv);
3743
3719
  Py_VISIT(traverse_module_state->__pyx_n_s_i);
3744
3720
  Py_VISIT(traverse_module_state->__pyx_n_s_id);
3745
3721
  Py_VISIT(traverse_module_state->__pyx_n_s_import);
@@ -3935,7 +3911,6 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) {
3935
3911
  #define __pyx_n_s_getstate __pyx_mstate_global->__pyx_n_s_getstate
3936
3912
  #define __pyx_kp_u_got __pyx_mstate_global->__pyx_kp_u_got
3937
3913
  #define __pyx_kp_u_got_differing_extents_in_dimensi __pyx_mstate_global->__pyx_kp_u_got_differing_extents_in_dimensi
3938
- #define __pyx_n_s_hash_bytes_mv __pyx_mstate_global->__pyx_n_s_hash_bytes_mv
3939
3914
  #define __pyx_n_s_i __pyx_mstate_global->__pyx_n_s_i
3940
3915
  #define __pyx_n_s_id __pyx_mstate_global->__pyx_n_s_id
3941
3916
  #define __pyx_n_s_import __pyx_mstate_global->__pyx_n_s_import
@@ -18007,7 +17982,7 @@ static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *__
18007
17982
  /* "cchecksum/_checksum.pyx":3
18008
17983
  * # cython: boundscheck=False
18009
17984
  *
18010
- * def cchecksum(str norm_address_no_0x, str address_hash_hex_no_0x) -> str: # <<<<<<<<<<<<<<
17985
+ * def cchecksum(str norm_address_no_0x, const unsigned char[::1] address_hash_hex_no_0x) -> str: # <<<<<<<<<<<<<<
18011
17986
  * """
18012
17987
  * Computes the checksummed version of an Ethereum address.
18013
17988
  */
@@ -18020,7 +17995,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
18020
17995
  PyObject *__pyx_args, PyObject *__pyx_kwds
18021
17996
  #endif
18022
17997
  ); /*proto*/
18023
- PyDoc_STRVAR(__pyx_doc_9cchecksum_9_checksum_cchecksum, "cchecksum(unicode norm_address_no_0x, unicode address_hash_hex_no_0x) -> str\n\n Computes the checksummed version of an Ethereum address.\n\n This function takes a normalized Ethereum address (without the '0x' prefix) and its corresponding\n hash (also without the '0x' prefix) and returns the checksummed address as per the Ethereum\n Improvement Proposal 55 (EIP-55).\n\n Args:\n norm_address_no_0x (str): The normalized Ethereum address without the '0x' prefix.\n address_hash_hex_no_0x (str): The hash of the address, also without the '0x' prefix.\n\n Returns:\n The checksummed Ethereum address with the '0x' prefix.\n\n Examples:\n >>> cchecksum(\"b47e3cd837ddf8e4c57f05d70ab865de6e193bbb\", \"abcdef1234567890abcdef1234567890abcdef12\")\n '0xB47E3Cd837DdF8E4C57F05D70Ab865De6E193BbB'\n\n >>> cchecksum(\"0000000000000000000000000000000000000000\", \"1234567890abcdef1234567890abcdef12345678\")\n '0x0000000000000000000000000000000000000000'\n\n See Also:\n - :func:`eth_utils.to_checksum_address`: A utility function for converting addresses to their checksummed form.\n ");
17998
+ PyDoc_STRVAR(__pyx_doc_9cchecksum_9_checksum_cchecksum, "cchecksum(unicode norm_address_no_0x, const unsigned char[::1] address_hash_hex_no_0x) -> str\n\n Computes the checksummed version of an Ethereum address.\n\n This function takes a normalized Ethereum address (without the '0x' prefix) and its corresponding\n hash (also without the '0x' prefix) and returns the checksummed address as per the Ethereum\n Improvement Proposal 55 (EIP-55).\n\n Args:\n norm_address_no_0x (str): The normalized Ethereum address without the '0x' prefix.\n address_hash_hex_no_0x (bytes): The hash of the address, also without the '0x' prefix.\n\n Returns:\n The checksummed Ethereum address with the '0x' prefix.\n\n Examples:\n >>> cchecksum(\"b47e3cd837ddf8e4c57f05d70ab865de6e193bbb\", \"abcdef1234567890abcdef1234567890abcdef12\")\n '0xB47E3Cd837DdF8E4C57F05D70Ab865De6E193BbB'\n\n >>> cchecksum(\"0000000000000000000000000000000000000000\", \"1234567890abcdef1234567890abcdef12345678\")\n '0x0000000000000000000000000000000000000000'\n\n See Also:\n - :func:`eth_utils.to_checksum_address`: A utility function for converting addresses to their checksummed form.\n ");
18024
17999
  static PyMethodDef __pyx_mdef_9cchecksum_9_checksum_1cchecksum = {"cchecksum", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9cchecksum_9_checksum_1cchecksum, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9cchecksum_9_checksum_cchecksum};
18025
18000
  static PyObject *__pyx_pw_9cchecksum_9_checksum_1cchecksum(PyObject *__pyx_self,
18026
18001
  #if CYTHON_METH_FASTCALL
@@ -18030,7 +18005,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds
18030
18005
  #endif
18031
18006
  ) {
18032
18007
  PyObject *__pyx_v_norm_address_no_0x = 0;
18033
- PyObject *__pyx_v_address_hash_hex_no_0x = 0;
18008
+ __Pyx_memviewslice __pyx_v_address_hash_hex_no_0x = { 0, 0, { 0 }, { 0 }, { 0 } };
18034
18009
  #if !CYTHON_METH_FASTCALL
18035
18010
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
18036
18011
  #endif
@@ -18093,7 +18068,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds
18093
18068
  values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
18094
18069
  }
18095
18070
  __pyx_v_norm_address_no_0x = ((PyObject*)values[0]);
18096
- __pyx_v_address_hash_hex_no_0x = ((PyObject*)values[1]);
18071
+ __pyx_v_address_hash_hex_no_0x = __Pyx_PyObject_to_MemoryviewSlice_dc_unsigned_char__const__(values[1], 0); if (unlikely(!__pyx_v_address_hash_hex_no_0x.memview)) __PYX_ERR(0, 3, __pyx_L3_error)
18097
18072
  }
18098
18073
  goto __pyx_L6_skip;
18099
18074
  __pyx_L5_argtuple_error:;
@@ -18107,12 +18082,12 @@ PyObject *__pyx_args, PyObject *__pyx_kwds
18107
18082
  __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
18108
18083
  }
18109
18084
  }
18085
+ __PYX_XCLEAR_MEMVIEW(&__pyx_v_address_hash_hex_no_0x, 1);
18110
18086
  __Pyx_AddTraceback("cchecksum._checksum.cchecksum", __pyx_clineno, __pyx_lineno, __pyx_filename);
18111
18087
  __Pyx_RefNannyFinishContext();
18112
18088
  return NULL;
18113
18089
  __pyx_L4_argument_unpacking_done:;
18114
18090
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_norm_address_no_0x), (&PyUnicode_Type), 1, "norm_address_no_0x", 1))) __PYX_ERR(0, 3, __pyx_L1_error)
18115
- if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_address_hash_hex_no_0x), (&PyUnicode_Type), 1, "address_hash_hex_no_0x", 1))) __PYX_ERR(0, 3, __pyx_L1_error)
18116
18091
  __pyx_r = __pyx_pf_9cchecksum_9_checksum_cchecksum(__pyx_self, __pyx_v_norm_address_no_0x, __pyx_v_address_hash_hex_no_0x);
18117
18092
 
18118
18093
  /* function exit code */
@@ -18120,6 +18095,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds
18120
18095
  __pyx_L1_error:;
18121
18096
  __pyx_r = NULL;
18122
18097
  __pyx_L0:;
18098
+ __PYX_XCLEAR_MEMVIEW(&__pyx_v_address_hash_hex_no_0x, 1);
18123
18099
  {
18124
18100
  Py_ssize_t __pyx_temp;
18125
18101
  for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
@@ -18130,9 +18106,8 @@ PyObject *__pyx_args, PyObject *__pyx_kwds
18130
18106
  return __pyx_r;
18131
18107
  }
18132
18108
 
18133
- static PyObject *__pyx_pf_9cchecksum_9_checksum_cchecksum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_norm_address_no_0x, PyObject *__pyx_v_address_hash_hex_no_0x) {
18109
+ static PyObject *__pyx_pf_9cchecksum_9_checksum_cchecksum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_norm_address_no_0x, __Pyx_memviewslice __pyx_v_address_hash_hex_no_0x) {
18134
18110
  __Pyx_memviewslice __pyx_v_norm_address_mv = { 0, 0, { 0 }, { 0 }, { 0 } };
18135
- __Pyx_memviewslice __pyx_v_hash_bytes_mv = { 0, 0, { 0 }, { 0 }, { 0 } };
18136
18111
  unsigned char __pyx_v_buffer[42];
18137
18112
  int __pyx_v_i;
18138
18113
  int __pyx_v_address_char;
@@ -18140,8 +18115,8 @@ static PyObject *__pyx_pf_9cchecksum_9_checksum_cchecksum(CYTHON_UNUSED PyObject
18140
18115
  __Pyx_TraceDeclarations
18141
18116
  __Pyx_RefNannyDeclarations
18142
18117
  PyObject *__pyx_t_1 = NULL;
18143
- PyObject *__pyx_t_2 = NULL;
18144
- __Pyx_memviewslice __pyx_t_3 = { 0, 0, { 0 }, { 0 }, { 0 } };
18118
+ __Pyx_memviewslice __pyx_t_2 = { 0, 0, { 0 }, { 0 }, { 0 } };
18119
+ PyObject *__pyx_t_3 = NULL;
18145
18120
  unsigned char __pyx_t_4[42];
18146
18121
  int __pyx_t_5;
18147
18122
  Py_ssize_t __pyx_t_6;
@@ -18157,9 +18132,9 @@ static PyObject *__pyx_pf_9cchecksum_9_checksum_cchecksum(CYTHON_UNUSED PyObject
18157
18132
  /* "cchecksum/_checksum.pyx":30
18158
18133
  *
18159
18134
  * # Declare memoryviews for fixed-length data
18160
- * cdef unsigned char[::1] norm_address_mv = bytearray(norm_address_no_0x.encode('ascii')) # <<<<<<<<<<<<<<
18161
- * cdef unsigned char[::1] hash_bytes_mv = bytearray(address_hash_hex_no_0x.encode('ascii'))
18135
+ * cdef const unsigned char[::1] norm_address_mv = norm_address_no_0x.encode('ascii') # <<<<<<<<<<<<<<
18162
18136
  *
18137
+ * # Create a buffer for our result
18163
18138
  */
18164
18139
  __Pyx_TraceLine(30,0,__PYX_ERR(0, 30, __pyx_L1_error))
18165
18140
  if (unlikely(__pyx_v_norm_address_no_0x == Py_None)) {
@@ -18168,120 +18143,96 @@ static PyObject *__pyx_pf_9cchecksum_9_checksum_cchecksum(CYTHON_UNUSED PyObject
18168
18143
  }
18169
18144
  __pyx_t_1 = PyUnicode_AsASCIIString(__pyx_v_norm_address_no_0x); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 30, __pyx_L1_error)
18170
18145
  __Pyx_GOTREF(__pyx_t_1);
18171
- __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyByteArray_Type)), __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 30, __pyx_L1_error)
18172
- __Pyx_GOTREF(__pyx_t_2);
18173
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
18174
- __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_dc_unsigned_char(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 30, __pyx_L1_error)
18175
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
18176
- __pyx_v_norm_address_mv = __pyx_t_3;
18177
- __pyx_t_3.memview = NULL;
18178
- __pyx_t_3.data = NULL;
18179
-
18180
- /* "cchecksum/_checksum.pyx":31
18181
- * # Declare memoryviews for fixed-length data
18182
- * cdef unsigned char[::1] norm_address_mv = bytearray(norm_address_no_0x.encode('ascii'))
18183
- * cdef unsigned char[::1] hash_bytes_mv = bytearray(address_hash_hex_no_0x.encode('ascii')) # <<<<<<<<<<<<<<
18184
- *
18185
- * # Create a buffer for our result
18186
- */
18187
- __Pyx_TraceLine(31,0,__PYX_ERR(0, 31, __pyx_L1_error))
18188
- if (unlikely(__pyx_v_address_hash_hex_no_0x == Py_None)) {
18189
- PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode");
18190
- __PYX_ERR(0, 31, __pyx_L1_error)
18191
- }
18192
- __pyx_t_2 = PyUnicode_AsASCIIString(__pyx_v_address_hash_hex_no_0x); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 31, __pyx_L1_error)
18193
- __Pyx_GOTREF(__pyx_t_2);
18194
- __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyByteArray_Type)), __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 31, __pyx_L1_error)
18195
- __Pyx_GOTREF(__pyx_t_1);
18196
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
18197
- __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_dc_unsigned_char(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 31, __pyx_L1_error)
18146
+ __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_dc_unsigned_char__const__(__pyx_t_1, 0); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 30, __pyx_L1_error)
18198
18147
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
18199
- __pyx_v_hash_bytes_mv = __pyx_t_3;
18200
- __pyx_t_3.memview = NULL;
18201
- __pyx_t_3.data = NULL;
18148
+ __pyx_v_norm_address_mv = __pyx_t_2;
18149
+ __pyx_t_2.memview = NULL;
18150
+ __pyx_t_2.data = NULL;
18202
18151
 
18203
- /* "cchecksum/_checksum.pyx":35
18152
+ /* "cchecksum/_checksum.pyx":34
18204
18153
  * # Create a buffer for our result
18205
18154
  * # 2 for "0x" prefix and 40 for the address itself
18206
18155
  * cdef unsigned char[42] buffer = b'0x' + bytearray(40) # <<<<<<<<<<<<<<
18207
18156
  *
18208
18157
  * # Handle character casing based on the hash value
18209
18158
  */
18210
- __Pyx_TraceLine(35,0,__PYX_ERR(0, 35, __pyx_L1_error))
18211
- __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)(&PyByteArray_Type)), __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 35, __pyx_L1_error)
18159
+ __Pyx_TraceLine(34,0,__PYX_ERR(0, 34, __pyx_L1_error))
18160
+ __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)(&PyByteArray_Type)), __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 34, __pyx_L1_error)
18212
18161
  __Pyx_GOTREF(__pyx_t_1);
18213
- __pyx_t_2 = PyNumber_Add(__pyx_kp_b_0x, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 35, __pyx_L1_error)
18214
- __Pyx_GOTREF(__pyx_t_2);
18162
+ __pyx_t_3 = PyNumber_Add(__pyx_kp_b_0x, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 34, __pyx_L1_error)
18163
+ __Pyx_GOTREF(__pyx_t_3);
18215
18164
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
18216
- if (unlikely((__Pyx_carray_from_py_unsigned_char(__pyx_t_2, __pyx_t_4, 42) < 0))) __PYX_ERR(0, 35, __pyx_L1_error)
18165
+ if (unlikely((__Pyx_carray_from_py_unsigned_char(__pyx_t_3, __pyx_t_4, 42) < 0))) __PYX_ERR(0, 34, __pyx_L1_error)
18217
18166
  memcpy(&(__pyx_v_buffer[0]), __pyx_t_4, sizeof(__pyx_v_buffer[0]) * (42));
18218
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
18167
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
18219
18168
 
18220
- /* "cchecksum/_checksum.pyx":41
18169
+ /* "cchecksum/_checksum.pyx":40
18221
18170
  * cdef int address_char
18222
18171
  *
18223
18172
  * for i in range(40): # <<<<<<<<<<<<<<
18224
- * address_char = norm_address_mv[i]
18225
18173
  *
18174
+ * if address_hash_hex_no_0x[i] < 56:
18226
18175
  */
18227
- __Pyx_TraceLine(41,0,__PYX_ERR(0, 41, __pyx_L1_error))
18176
+ __Pyx_TraceLine(40,0,__PYX_ERR(0, 40, __pyx_L1_error))
18228
18177
  for (__pyx_t_5 = 0; __pyx_t_5 < 40; __pyx_t_5+=1) {
18229
18178
  __pyx_v_i = __pyx_t_5;
18230
18179
 
18231
18180
  /* "cchecksum/_checksum.pyx":42
18232
- *
18233
18181
  * for i in range(40):
18234
- * address_char = norm_address_mv[i] # <<<<<<<<<<<<<<
18235
- *
18236
- * if hash_bytes_mv[i] < 56:
18237
- */
18238
- __Pyx_TraceLine(42,0,__PYX_ERR(0, 42, __pyx_L1_error))
18239
- __pyx_t_6 = __pyx_v_i;
18240
- if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_norm_address_mv.shape[0];
18241
- __pyx_v_address_char = (*((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_norm_address_mv.data) + __pyx_t_6)) )));
18242
-
18243
- /* "cchecksum/_checksum.pyx":44
18244
- * address_char = norm_address_mv[i]
18245
18182
  *
18246
- * if hash_bytes_mv[i] < 56: # <<<<<<<<<<<<<<
18183
+ * if address_hash_hex_no_0x[i] < 56: # <<<<<<<<<<<<<<
18247
18184
  * # '0' to '7' have ASCII values 48 to 55
18248
- * buffer[i + 2] = address_char
18185
+ * buffer[i + 2] = norm_address_mv[i]
18249
18186
  */
18250
- __Pyx_TraceLine(44,0,__PYX_ERR(0, 44, __pyx_L1_error))
18187
+ __Pyx_TraceLine(42,0,__PYX_ERR(0, 42, __pyx_L1_error))
18251
18188
  __pyx_t_6 = __pyx_v_i;
18252
- if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_hash_bytes_mv.shape[0];
18253
- __pyx_t_7 = ((*((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_hash_bytes_mv.data) + __pyx_t_6)) ))) < 56);
18189
+ if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_address_hash_hex_no_0x.shape[0];
18190
+ __pyx_t_7 = ((*((unsigned char const *) ( /* dim=0 */ ((char *) (((unsigned char const *) __pyx_v_address_hash_hex_no_0x.data) + __pyx_t_6)) ))) < 56);
18254
18191
  if (__pyx_t_7) {
18255
18192
 
18256
- /* "cchecksum/_checksum.pyx":46
18257
- * if hash_bytes_mv[i] < 56:
18193
+ /* "cchecksum/_checksum.pyx":44
18194
+ * if address_hash_hex_no_0x[i] < 56:
18258
18195
  * # '0' to '7' have ASCII values 48 to 55
18259
- * buffer[i + 2] = address_char # <<<<<<<<<<<<<<
18196
+ * buffer[i + 2] = norm_address_mv[i] # <<<<<<<<<<<<<<
18260
18197
  *
18261
18198
  * else:
18262
18199
  */
18263
- __Pyx_TraceLine(46,0,__PYX_ERR(0, 46, __pyx_L1_error))
18264
- (__pyx_v_buffer[(__pyx_v_i + 2)]) = __pyx_v_address_char;
18200
+ __Pyx_TraceLine(44,0,__PYX_ERR(0, 44, __pyx_L1_error))
18201
+ __pyx_t_6 = __pyx_v_i;
18202
+ if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_norm_address_mv.shape[0];
18203
+ (__pyx_v_buffer[(__pyx_v_i + 2)]) = (*((unsigned char const *) ( /* dim=0 */ ((char *) (((unsigned char const *) __pyx_v_norm_address_mv.data) + __pyx_t_6)) )));
18265
18204
 
18266
- /* "cchecksum/_checksum.pyx":44
18267
- * address_char = norm_address_mv[i]
18205
+ /* "cchecksum/_checksum.pyx":42
18206
+ * for i in range(40):
18268
18207
  *
18269
- * if hash_bytes_mv[i] < 56: # <<<<<<<<<<<<<<
18208
+ * if address_hash_hex_no_0x[i] < 56: # <<<<<<<<<<<<<<
18270
18209
  * # '0' to '7' have ASCII values 48 to 55
18271
- * buffer[i + 2] = address_char
18210
+ * buffer[i + 2] = norm_address_mv[i]
18272
18211
  */
18273
18212
  goto __pyx_L5;
18274
18213
  }
18275
18214
 
18276
- /* "cchecksum/_checksum.pyx":52
18215
+ /* "cchecksum/_checksum.pyx":47
18216
+ *
18217
+ * else:
18218
+ * address_char = norm_address_mv[i] # <<<<<<<<<<<<<<
18219
+ * # This checks if `address_char` falls in the ASCII range for lowercase hexadecimal
18220
+ * # characters ('a' to 'f'), which correspond to ASCII values 97 to 102. If it does,
18221
+ */
18222
+ __Pyx_TraceLine(47,0,__PYX_ERR(0, 47, __pyx_L1_error))
18223
+ /*else*/ {
18224
+ __pyx_t_6 = __pyx_v_i;
18225
+ if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_norm_address_mv.shape[0];
18226
+ __pyx_v_address_char = (*((unsigned char const *) ( /* dim=0 */ ((char *) (((unsigned char const *) __pyx_v_norm_address_mv.data) + __pyx_t_6)) )));
18227
+
18228
+ /* "cchecksum/_checksum.pyx":51
18277
18229
  * # characters ('a' to 'f'), which correspond to ASCII values 97 to 102. If it does,
18278
18230
  * # the character is capitalized.
18279
18231
  * buffer[i + 2] = address_char - 32 if 97 <= address_char <= 102 else address_char # <<<<<<<<<<<<<<
18280
18232
  *
18281
18233
  * # NOTE: For some reason on some systems the buffer length is longer than 42 here, even though that should not be possible.
18282
18234
  */
18283
- __Pyx_TraceLine(52,0,__PYX_ERR(0, 52, __pyx_L1_error))
18284
- /*else*/ {
18235
+ __Pyx_TraceLine(51,0,__PYX_ERR(0, 51, __pyx_L1_error))
18285
18236
  __pyx_t_7 = (97 <= __pyx_v_address_char);
18286
18237
  if (__pyx_t_7) {
18287
18238
  __pyx_t_7 = (__pyx_v_address_char <= 0x66);
@@ -18296,29 +18247,23 @@ static PyObject *__pyx_pf_9cchecksum_9_checksum_cchecksum(CYTHON_UNUSED PyObject
18296
18247
  __pyx_L5:;
18297
18248
  }
18298
18249
 
18299
- /* "cchecksum/_checksum.pyx":56
18250
+ /* "cchecksum/_checksum.pyx":55
18300
18251
  * # NOTE: For some reason on some systems the buffer length is longer than 42 here, even though that should not be possible.
18301
18252
  * # Lucky for us, the first 42 characters are always correct. One day maybe I'll debug this.
18302
- * return bytes(buffer[:42]).decode('ascii') # <<<<<<<<<<<<<<
18253
+ * return buffer[:42].decode('ascii') # <<<<<<<<<<<<<<
18303
18254
  */
18304
- __Pyx_TraceLine(56,0,__PYX_ERR(0, 56, __pyx_L1_error))
18255
+ __Pyx_TraceLine(55,0,__PYX_ERR(0, 55, __pyx_L1_error))
18305
18256
  __Pyx_XDECREF(__pyx_r);
18306
- __pyx_t_2 = __Pyx_PyBytes_FromStringAndSize(((const char*)__pyx_v_buffer) + 0, 42 - 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 56, __pyx_L1_error)
18307
- __Pyx_GOTREF(__pyx_t_2);
18308
- __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyBytes_Type)), __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 56, __pyx_L1_error)
18309
- __Pyx_GOTREF(__pyx_t_1);
18310
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
18311
- __pyx_t_2 = __Pyx_decode_bytes(__pyx_t_1, 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 56, __pyx_L1_error)
18312
- __Pyx_GOTREF(__pyx_t_2);
18313
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
18314
- __pyx_r = ((PyObject*)__pyx_t_2);
18315
- __pyx_t_2 = 0;
18257
+ __pyx_t_3 = __Pyx_decode_c_string(((char const *)__pyx_v_buffer), 0, 42, NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 55, __pyx_L1_error)
18258
+ __Pyx_GOTREF(__pyx_t_3);
18259
+ __pyx_r = ((PyObject*)__pyx_t_3);
18260
+ __pyx_t_3 = 0;
18316
18261
  goto __pyx_L0;
18317
18262
 
18318
18263
  /* "cchecksum/_checksum.pyx":3
18319
18264
  * # cython: boundscheck=False
18320
18265
  *
18321
- * def cchecksum(str norm_address_no_0x, str address_hash_hex_no_0x) -> str: # <<<<<<<<<<<<<<
18266
+ * def cchecksum(str norm_address_no_0x, const unsigned char[::1] address_hash_hex_no_0x) -> str: # <<<<<<<<<<<<<<
18322
18267
  * """
18323
18268
  * Computes the checksummed version of an Ethereum address.
18324
18269
  */
@@ -18326,13 +18271,12 @@ static PyObject *__pyx_pf_9cchecksum_9_checksum_cchecksum(CYTHON_UNUSED PyObject
18326
18271
  /* function exit code */
18327
18272
  __pyx_L1_error:;
18328
18273
  __Pyx_XDECREF(__pyx_t_1);
18329
- __Pyx_XDECREF(__pyx_t_2);
18330
- __PYX_XCLEAR_MEMVIEW(&__pyx_t_3, 1);
18274
+ __PYX_XCLEAR_MEMVIEW(&__pyx_t_2, 1);
18275
+ __Pyx_XDECREF(__pyx_t_3);
18331
18276
  __Pyx_AddTraceback("cchecksum._checksum.cchecksum", __pyx_clineno, __pyx_lineno, __pyx_filename);
18332
18277
  __pyx_r = NULL;
18333
18278
  __pyx_L0:;
18334
18279
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_norm_address_mv, 1);
18335
- __PYX_XCLEAR_MEMVIEW(&__pyx_v_hash_bytes_mv, 1);
18336
18280
  __Pyx_XGIVEREF(__pyx_r);
18337
18281
  __Pyx_TraceReturn(__pyx_r, 0);
18338
18282
  __Pyx_RefNannyFinishContext();
@@ -19389,7 +19333,6 @@ static int __Pyx_CreateStringTabAndInitStrings(void) {
19389
19333
  {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1},
19390
19334
  {&__pyx_kp_u_got, __pyx_k_got, sizeof(__pyx_k_got), 0, 1, 0, 0},
19391
19335
  {&__pyx_kp_u_got_differing_extents_in_dimensi, __pyx_k_got_differing_extents_in_dimensi, sizeof(__pyx_k_got_differing_extents_in_dimensi), 0, 1, 0, 0},
19392
- {&__pyx_n_s_hash_bytes_mv, __pyx_k_hash_bytes_mv, sizeof(__pyx_k_hash_bytes_mv), 0, 0, 1, 1},
19393
19336
  {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1},
19394
19337
  {&__pyx_n_s_id, __pyx_k_id, sizeof(__pyx_k_id), 0, 0, 1, 1},
19395
19338
  {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
@@ -19452,7 +19395,7 @@ static int __Pyx_CreateStringTabAndInitStrings(void) {
19452
19395
  }
19453
19396
  /* #### Code section: cached_builtins ### */
19454
19397
  static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
19455
- __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 41, __pyx_L1_error)
19398
+ __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 40, __pyx_L1_error)
19456
19399
  __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(1, 83, __pyx_L1_error)
19457
19400
  __pyx_builtin_OverflowError = __Pyx_GetBuiltinName(__pyx_n_s_OverflowError); if (!__pyx_builtin_OverflowError) __PYX_ERR(1, 83, __pyx_L1_error)
19458
19401
  __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(1, 86, __pyx_L1_error)
@@ -19509,14 +19452,14 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
19509
19452
  __Pyx_GOTREF(__pyx_tuple__8);
19510
19453
  __Pyx_GIVEREF(__pyx_tuple__8);
19511
19454
 
19512
- /* "cchecksum/_checksum.pyx":35
19455
+ /* "cchecksum/_checksum.pyx":34
19513
19456
  * # Create a buffer for our result
19514
19457
  * # 2 for "0x" prefix and 40 for the address itself
19515
19458
  * cdef unsigned char[42] buffer = b'0x' + bytearray(40) # <<<<<<<<<<<<<<
19516
19459
  *
19517
19460
  * # Handle character casing based on the hash value
19518
19461
  */
19519
- __pyx_tuple__10 = PyTuple_Pack(1, __pyx_int_40); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 35, __pyx_L1_error)
19462
+ __pyx_tuple__10 = PyTuple_Pack(1, __pyx_int_40); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 34, __pyx_L1_error)
19520
19463
  __Pyx_GOTREF(__pyx_tuple__10);
19521
19464
  __Pyx_GIVEREF(__pyx_tuple__10);
19522
19465
 
@@ -19624,14 +19567,14 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
19624
19567
  /* "cchecksum/_checksum.pyx":3
19625
19568
  * # cython: boundscheck=False
19626
19569
  *
19627
- * def cchecksum(str norm_address_no_0x, str address_hash_hex_no_0x) -> str: # <<<<<<<<<<<<<<
19570
+ * def cchecksum(str norm_address_no_0x, const unsigned char[::1] address_hash_hex_no_0x) -> str: # <<<<<<<<<<<<<<
19628
19571
  * """
19629
19572
  * Computes the checksummed version of an Ethereum address.
19630
19573
  */
19631
- __pyx_tuple__22 = PyTuple_Pack(7, __pyx_n_s_norm_address_no_0x, __pyx_n_s_address_hash_hex_no_0x, __pyx_n_s_norm_address_mv, __pyx_n_s_hash_bytes_mv, __pyx_n_s_buffer, __pyx_n_s_i, __pyx_n_s_address_char); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(0, 3, __pyx_L1_error)
19574
+ __pyx_tuple__22 = PyTuple_Pack(6, __pyx_n_s_norm_address_no_0x, __pyx_n_s_address_hash_hex_no_0x, __pyx_n_s_norm_address_mv, __pyx_n_s_buffer, __pyx_n_s_i, __pyx_n_s_address_char); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(0, 3, __pyx_L1_error)
19632
19575
  __Pyx_GOTREF(__pyx_tuple__22);
19633
19576
  __Pyx_GIVEREF(__pyx_tuple__22);
19634
- __pyx_codeobj__9 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__22, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cchecksum__checksum_pyx, __pyx_n_s_cchecksum, 3, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__9)) __PYX_ERR(0, 3, __pyx_L1_error)
19577
+ __pyx_codeobj__9 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__22, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cchecksum__checksum_pyx, __pyx_n_s_cchecksum, 3, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__9)) __PYX_ERR(0, 3, __pyx_L1_error)
19635
19578
  __Pyx_RefNannyFinishContext();
19636
19579
  return 0;
19637
19580
  __pyx_L1_error:;
@@ -20698,7 +20641,7 @@ if (!__Pyx_RefNanny) {
20698
20641
  /* "cchecksum/_checksum.pyx":3
20699
20642
  * # cython: boundscheck=False
20700
20643
  *
20701
- * def cchecksum(str norm_address_no_0x, str address_hash_hex_no_0x) -> str: # <<<<<<<<<<<<<<
20644
+ * def cchecksum(str norm_address_no_0x, const unsigned char[::1] address_hash_hex_no_0x) -> str: # <<<<<<<<<<<<<<
20702
20645
  * """
20703
20646
  * Computes the checksummed version of an Ethereum address.
20704
20647
  */
@@ -20716,7 +20659,7 @@ if (!__Pyx_RefNanny) {
20716
20659
  /* "cchecksum/_checksum.pyx":1
20717
20660
  * # cython: boundscheck=False # <<<<<<<<<<<<<<
20718
20661
  *
20719
- * def cchecksum(str norm_address_no_0x, str address_hash_hex_no_0x) -> str:
20662
+ * def cchecksum(str norm_address_no_0x, const unsigned char[::1] address_hash_hex_no_0x) -> str:
20720
20663
  */
20721
20664
  __Pyx_TraceLine(1,0,__PYX_ERR(0, 1, __pyx_L1_error))
20722
20665
  __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1, __pyx_L1_error)
@@ -23300,12 +23243,20 @@ static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) {
23300
23243
  }
23301
23244
  }
23302
23245
 
23303
- /* decode_c_bytes */
23304
- static CYTHON_INLINE PyObject* __Pyx_decode_c_bytes(
23305
- const char* cstring, Py_ssize_t length, Py_ssize_t start, Py_ssize_t stop,
23246
+ /* decode_c_string */
23247
+ static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
23248
+ const char* cstring, Py_ssize_t start, Py_ssize_t stop,
23306
23249
  const char* encoding, const char* errors,
23307
23250
  PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) {
23251
+ Py_ssize_t length;
23308
23252
  if (unlikely((start < 0) | (stop < 0))) {
23253
+ size_t slen = strlen(cstring);
23254
+ if (unlikely(slen > (size_t) PY_SSIZE_T_MAX)) {
23255
+ PyErr_SetString(PyExc_OverflowError,
23256
+ "c-string too long to convert to Python");
23257
+ return NULL;
23258
+ }
23259
+ length = (Py_ssize_t) slen;
23309
23260
  if (start < 0) {
23310
23261
  start += length;
23311
23262
  if (start < 0)
@@ -23314,8 +23265,6 @@ static CYTHON_INLINE PyObject* __Pyx_decode_c_bytes(
23314
23265
  if (stop < 0)
23315
23266
  stop += length;
23316
23267
  }
23317
- if (stop > length)
23318
- stop = length;
23319
23268
  if (unlikely(stop <= start))
23320
23269
  return __Pyx_NewRef(__pyx_empty_unicode);
23321
23270
  length = stop - start;
@@ -26271,7 +26220,7 @@ no_fail:
26271
26220
  }
26272
26221
 
26273
26222
  /* ObjectToMemviewSlice */
26274
- static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dc_unsigned_char(PyObject *obj, int writable_flag) {
26223
+ static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dc_unsigned_char__const__(PyObject *obj, int writable_flag) {
26275
26224
  __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
26276
26225
  __Pyx_BufFmt_StackElem stack[1];
26277
26226
  int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_CONTIG) };
@@ -26282,7 +26231,7 @@ no_fail:
26282
26231
  }
26283
26232
  retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, __Pyx_IS_C_CONTIG,
26284
26233
  (PyBUF_C_CONTIGUOUS | PyBUF_FORMAT) | writable_flag, 1,
26285
- &__Pyx_TypeInfo_unsigned_char, stack,
26234
+ &__Pyx_TypeInfo_unsigned_char__const__, stack,
26286
26235
  &result, obj);
26287
26236
  if (unlikely(retcode == -1))
26288
26237
  goto __pyx_fail;
@@ -0,0 +1,3 @@
1
+ from eth_typing import ChecksumAddress
2
+
3
+ def cchecksum(norm_address_no_0x: str, address_hash_hex_no_0x: bytes) -> ChecksumAddress: ...
@@ -1,6 +1,6 @@
1
1
  # cython: boundscheck=False
2
2
 
3
- def cchecksum(str norm_address_no_0x, str address_hash_hex_no_0x) -> str:
3
+ def cchecksum(str norm_address_no_0x, const unsigned char[::1] address_hash_hex_no_0x) -> str:
4
4
  """
5
5
  Computes the checksummed version of an Ethereum address.
6
6
 
@@ -10,7 +10,7 @@ def cchecksum(str norm_address_no_0x, str address_hash_hex_no_0x) -> str:
10
10
 
11
11
  Args:
12
12
  norm_address_no_0x (str): The normalized Ethereum address without the '0x' prefix.
13
- address_hash_hex_no_0x (str): The hash of the address, also without the '0x' prefix.
13
+ address_hash_hex_no_0x (bytes): The hash of the address, also without the '0x' prefix.
14
14
 
15
15
  Returns:
16
16
  The checksummed Ethereum address with the '0x' prefix.
@@ -27,8 +27,7 @@ def cchecksum(str norm_address_no_0x, str address_hash_hex_no_0x) -> str:
27
27
  """
28
28
 
29
29
  # Declare memoryviews for fixed-length data
30
- cdef unsigned char[::1] norm_address_mv = bytearray(norm_address_no_0x.encode('ascii'))
31
- cdef unsigned char[::1] hash_bytes_mv = bytearray(address_hash_hex_no_0x.encode('ascii'))
30
+ cdef const unsigned char[::1] norm_address_mv = norm_address_no_0x.encode('ascii')
32
31
 
33
32
  # Create a buffer for our result
34
33
  # 2 for "0x" prefix and 40 for the address itself
@@ -39,18 +38,18 @@ def cchecksum(str norm_address_no_0x, str address_hash_hex_no_0x) -> str:
39
38
  cdef int address_char
40
39
 
41
40
  for i in range(40):
42
- address_char = norm_address_mv[i]
43
41
 
44
- if hash_bytes_mv[i] < 56:
42
+ if address_hash_hex_no_0x[i] < 56:
45
43
  # '0' to '7' have ASCII values 48 to 55
46
- buffer[i + 2] = address_char
44
+ buffer[i + 2] = norm_address_mv[i]
47
45
 
48
46
  else:
49
- # This checks if `norm_char` falls in the ASCII range for lowercase hexadecimal
47
+ address_char = norm_address_mv[i]
48
+ # This checks if `address_char` falls in the ASCII range for lowercase hexadecimal
50
49
  # characters ('a' to 'f'), which correspond to ASCII values 97 to 102. If it does,
51
50
  # the character is capitalized.
52
51
  buffer[i + 2] = address_char - 32 if 97 <= address_char <= 102 else address_char
53
52
 
54
53
  # NOTE: For some reason on some systems the buffer length is longer than 42 here, even though that should not be possible.
55
54
  # Lucky for us, the first 42 characters are always correct. One day maybe I'll debug this.
56
- return bytes(buffer[:42]).decode('ascii')
55
+ return buffer[:42].decode('ascii')
@@ -52,8 +52,7 @@ def to_checksum_address(value: Union[AnyAddress, str, bytes]) -> ChecksumAddress
52
52
  - :func:`to_normalized_address` for converting to a normalized address before checksumming.
53
53
  """
54
54
  norm_address_no_0x = to_normalized_address(value)[2:]
55
- address_hash_hex_no_0x = hash_address(norm_address_no_0x).decode("ascii")
56
- return cchecksum(norm_address_no_0x, address_hash_hex_no_0x)
55
+ return cchecksum(norm_address_no_0x, hash_address(norm_address_no_0x))
57
56
 
58
57
 
59
58
  def to_normalized_address(value: Union[AnyAddress, str, bytes]) -> HexAddress:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cchecksum
3
- Version: 0.0.8
3
+ Version: 0.0.10
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
@@ -36,6 +36,7 @@ exclude_patterns = [
36
36
  # Looks for objects in documentation of external libraries
37
37
  intersphinx_mapping = {
38
38
  "eth_typing": ("https://eth-typing.readthedocs.io/en/stable/", None),
39
+ "eth_utils": ("https://eth-utils.readthedocs.io/en/stable/", None),
39
40
  "python": ("https://docs.python.org/3", None),
40
41
  }
41
42
 
@@ -1,3 +0,0 @@
1
- from eth_typing import ChecksumAddress
2
-
3
- def cchecksum(norm_address_no_0x: str, address_hash_hex_no_0x: str) -> ChecksumAddress: ...
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