cchecksum 0.0.10__tar.gz → 0.0.12__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.10 → cchecksum-0.0.12}/.github/workflows/pytest.yaml +1 -1
  2. {cchecksum-0.0.10 → cchecksum-0.0.12}/PKG-INFO +2 -2
  3. cchecksum-0.0.12/README.md +9 -0
  4. {cchecksum-0.0.10 → cchecksum-0.0.12}/cchecksum/_checksum.c +60 -63
  5. {cchecksum-0.0.10 → cchecksum-0.0.12}/cchecksum/_checksum.pyx +4 -4
  6. {cchecksum-0.0.10 → cchecksum-0.0.12}/cchecksum.egg-info/PKG-INFO +2 -2
  7. {cchecksum-0.0.10 → cchecksum-0.0.12}/setup.py +1 -1
  8. cchecksum-0.0.10/README.md +0 -7
  9. {cchecksum-0.0.10 → cchecksum-0.0.12}/.github/workflows/black.yaml +0 -0
  10. {cchecksum-0.0.10 → cchecksum-0.0.12}/.github/workflows/deploy-docs.yaml +0 -0
  11. {cchecksum-0.0.10 → cchecksum-0.0.12}/.github/workflows/release.yaml +0 -0
  12. {cchecksum-0.0.10 → cchecksum-0.0.12}/.gitignore +0 -0
  13. {cchecksum-0.0.10 → cchecksum-0.0.12}/LICENSE +0 -0
  14. {cchecksum-0.0.10 → cchecksum-0.0.12}/Makefile +0 -0
  15. {cchecksum-0.0.10 → cchecksum-0.0.12}/cchecksum/__init__.py +0 -0
  16. {cchecksum-0.0.10 → cchecksum-0.0.12}/cchecksum/_checksum.pyi +0 -0
  17. {cchecksum-0.0.10 → cchecksum-0.0.12}/cchecksum/checksum.py +0 -0
  18. {cchecksum-0.0.10 → cchecksum-0.0.12}/cchecksum/checksum.pyi +0 -0
  19. {cchecksum-0.0.10 → cchecksum-0.0.12}/cchecksum/py.typed +0 -0
  20. {cchecksum-0.0.10 → cchecksum-0.0.12}/cchecksum.egg-info/SOURCES.txt +0 -0
  21. {cchecksum-0.0.10 → cchecksum-0.0.12}/cchecksum.egg-info/dependency_links.txt +0 -0
  22. {cchecksum-0.0.10 → cchecksum-0.0.12}/cchecksum.egg-info/not-zip-safe +0 -0
  23. {cchecksum-0.0.10 → cchecksum-0.0.12}/cchecksum.egg-info/requires.txt +0 -0
  24. {cchecksum-0.0.10 → cchecksum-0.0.12}/cchecksum.egg-info/top_level.txt +0 -0
  25. {cchecksum-0.0.10 → cchecksum-0.0.12}/docs/Makefile +0 -0
  26. {cchecksum-0.0.10 → cchecksum-0.0.12}/docs/_build/html/_static/alabaster.css +0 -0
  27. {cchecksum-0.0.10 → cchecksum-0.0.12}/docs/_build/html/_static/basic.css +0 -0
  28. {cchecksum-0.0.10 → cchecksum-0.0.12}/docs/_build/html/_static/custom.css +0 -0
  29. {cchecksum-0.0.10 → cchecksum-0.0.12}/docs/_build/html/_static/doctools.js +0 -0
  30. {cchecksum-0.0.10 → cchecksum-0.0.12}/docs/_build/html/_static/documentation_options.js +0 -0
  31. {cchecksum-0.0.10 → cchecksum-0.0.12}/docs/_build/html/_static/file.png +0 -0
  32. {cchecksum-0.0.10 → cchecksum-0.0.12}/docs/_build/html/_static/language_data.js +0 -0
  33. {cchecksum-0.0.10 → cchecksum-0.0.12}/docs/_build/html/_static/minus.png +0 -0
  34. {cchecksum-0.0.10 → cchecksum-0.0.12}/docs/_build/html/_static/plus.png +0 -0
  35. {cchecksum-0.0.10 → cchecksum-0.0.12}/docs/_build/html/_static/pygments.css +0 -0
  36. {cchecksum-0.0.10 → cchecksum-0.0.12}/docs/_build/html/_static/searchtools.js +0 -0
  37. {cchecksum-0.0.10 → cchecksum-0.0.12}/docs/_build/html/_static/sphinx_highlight.js +0 -0
  38. {cchecksum-0.0.10 → cchecksum-0.0.12}/docs/conf.py +0 -0
  39. {cchecksum-0.0.10 → cchecksum-0.0.12}/docs/index.rst +0 -0
  40. {cchecksum-0.0.10 → cchecksum-0.0.12}/docs/make.bat +0 -0
  41. {cchecksum-0.0.10 → cchecksum-0.0.12}/pyproject.toml +0 -0
  42. {cchecksum-0.0.10 → cchecksum-0.0.12}/requirements.txt +0 -0
  43. {cchecksum-0.0.10 → cchecksum-0.0.12}/setup.cfg +0 -0
  44. {cchecksum-0.0.10 → cchecksum-0.0.12}/test_checksum.py +0 -0
@@ -48,4 +48,4 @@ jobs:
48
48
  pip install -e .
49
49
 
50
50
  - name: Run test suite
51
- run: pytest
51
+ run: pytest -s -v
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cchecksum
3
- Version: 0.0.10
4
- Summary: A ~2x faster drop-in replacement for eth_utils.to_checksum_address. Raises the exact same Exceptions. Implemented in C.
3
+ Version: 0.0.12
4
+ Summary: A ~4.5x 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
7
7
  Author-email: bobthebuidlerdefi@gmail.com
@@ -0,0 +1,9 @@
1
+ ## CChecksum
2
+
3
+ CChecksum is a ~4.5x faster drop-in replacement for eth_utils.to_checksum_address, with the most cpu-intensive part implemented in c.
4
+
5
+ It keeps the exact same API as the existing implementation, exceptions and all.
6
+
7
+ Just `pip install cchecksum`, drop it in, and run your script with a substantial speed improvement.
8
+
9
+ ![image](https://github.com/user-attachments/assets/f2732c1f-f36e-486c-9258-cdeb09bb5eb5)
@@ -3126,7 +3126,7 @@ static const char __pyx_k_dtype_is_object[] = "dtype_is_object";
3126
3126
  static const char __pyx_k_norm_address_mv[] = "norm_address_mv";
3127
3127
  static const char __pyx_k_pyx_PickleError[] = "__pyx_PickleError";
3128
3128
  static const char __pyx_k_setstate_cython[] = "__setstate_cython__";
3129
- static const char __pyx_k_cchecksum_line_3[] = "cchecksum (line 3)";
3129
+ static const char __pyx_k_cchecksum_line_4[] = "cchecksum (line 4)";
3130
3130
  static const char __pyx_k_pyx_unpickle_Enum[] = "__pyx_unpickle_Enum";
3131
3131
  static const char __pyx_k_asyncio_coroutines[] = "asyncio.coroutines";
3132
3132
  static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
@@ -3148,7 +3148,7 @@ static const char __pyx_k_Step_may_not_be_zero_axis_d[] = "Step may not be zero
3148
3148
  static const char __pyx_k_itemsize_0_for_cython_array[] = "itemsize <= 0 for cython.array";
3149
3149
  static const char __pyx_k_unable_to_allocate_array_data[] = "unable to allocate array data.";
3150
3150
  static const char __pyx_k_strided_and_direct_or_indirect[] = "<strided and direct or indirect>";
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 ";
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: The normalized Ethereum address without the '0x' prefix.\n address_hash_hex_no_0x: 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 ";
3152
3152
  static const char __pyx_k_All_dimensions_preceding_dimensi[] = "All dimensions preceding dimension %d must be indexed and not sliced";
3153
3153
  static const char __pyx_k_Buffer_view_does_not_expose_stri[] = "Buffer view does not expose strides";
3154
3154
  static const char __pyx_k_Can_only_create_a_buffer_that_is[] = "Can only create a buffer that is contiguous in memory.";
@@ -3300,7 +3300,7 @@ typedef struct {
3300
3300
  PyObject *__pyx_n_s_cchecksum;
3301
3301
  PyObject *__pyx_n_s_cchecksum__checksum;
3302
3302
  PyObject *__pyx_kp_s_cchecksum__checksum_pyx;
3303
- PyObject *__pyx_kp_u_cchecksum_line_3;
3303
+ PyObject *__pyx_kp_u_cchecksum_line_4;
3304
3304
  PyObject *__pyx_n_s_class;
3305
3305
  PyObject *__pyx_n_s_class_getitem;
3306
3306
  PyObject *__pyx_n_s_cline_in_traceback;
@@ -3507,7 +3507,7 @@ static int __pyx_m_clear(PyObject *m) {
3507
3507
  Py_CLEAR(clear_module_state->__pyx_n_s_cchecksum);
3508
3508
  Py_CLEAR(clear_module_state->__pyx_n_s_cchecksum__checksum);
3509
3509
  Py_CLEAR(clear_module_state->__pyx_kp_s_cchecksum__checksum_pyx);
3510
- Py_CLEAR(clear_module_state->__pyx_kp_u_cchecksum_line_3);
3510
+ Py_CLEAR(clear_module_state->__pyx_kp_u_cchecksum_line_4);
3511
3511
  Py_CLEAR(clear_module_state->__pyx_n_s_class);
3512
3512
  Py_CLEAR(clear_module_state->__pyx_n_s_class_getitem);
3513
3513
  Py_CLEAR(clear_module_state->__pyx_n_s_cline_in_traceback);
@@ -3692,7 +3692,7 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) {
3692
3692
  Py_VISIT(traverse_module_state->__pyx_n_s_cchecksum);
3693
3693
  Py_VISIT(traverse_module_state->__pyx_n_s_cchecksum__checksum);
3694
3694
  Py_VISIT(traverse_module_state->__pyx_kp_s_cchecksum__checksum_pyx);
3695
- Py_VISIT(traverse_module_state->__pyx_kp_u_cchecksum_line_3);
3695
+ Py_VISIT(traverse_module_state->__pyx_kp_u_cchecksum_line_4);
3696
3696
  Py_VISIT(traverse_module_state->__pyx_n_s_class);
3697
3697
  Py_VISIT(traverse_module_state->__pyx_n_s_class_getitem);
3698
3698
  Py_VISIT(traverse_module_state->__pyx_n_s_cline_in_traceback);
@@ -3887,7 +3887,7 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) {
3887
3887
  #define __pyx_n_s_cchecksum __pyx_mstate_global->__pyx_n_s_cchecksum
3888
3888
  #define __pyx_n_s_cchecksum__checksum __pyx_mstate_global->__pyx_n_s_cchecksum__checksum
3889
3889
  #define __pyx_kp_s_cchecksum__checksum_pyx __pyx_mstate_global->__pyx_kp_s_cchecksum__checksum_pyx
3890
- #define __pyx_kp_u_cchecksum_line_3 __pyx_mstate_global->__pyx_kp_u_cchecksum_line_3
3890
+ #define __pyx_kp_u_cchecksum_line_4 __pyx_mstate_global->__pyx_kp_u_cchecksum_line_4
3891
3891
  #define __pyx_n_s_class __pyx_mstate_global->__pyx_n_s_class
3892
3892
  #define __pyx_n_s_class_getitem __pyx_mstate_global->__pyx_n_s_class_getitem
3893
3893
  #define __pyx_n_s_cline_in_traceback __pyx_mstate_global->__pyx_n_s_cline_in_traceback
@@ -17979,8 +17979,8 @@ static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *__
17979
17979
  return __pyx_r;
17980
17980
  }
17981
17981
 
17982
- /* "cchecksum/_checksum.pyx":3
17983
- * # cython: boundscheck=False
17982
+ /* "cchecksum/_checksum.pyx":4
17983
+ * # cython: wraparound=False
17984
17984
  *
17985
17985
  * def cchecksum(str norm_address_no_0x, const unsigned char[::1] address_hash_hex_no_0x) -> str: # <<<<<<<<<<<<<<
17986
17986
  * """
@@ -17995,7 +17995,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
17995
17995
  PyObject *__pyx_args, PyObject *__pyx_kwds
17996
17996
  #endif
17997
17997
  ); /*proto*/
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 ");
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: The normalized Ethereum address without the '0x' prefix.\n address_hash_hex_no_0x: 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 ");
17999
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};
18000
18000
  static PyObject *__pyx_pw_9cchecksum_9_checksum_1cchecksum(PyObject *__pyx_self,
18001
18001
  #if CYTHON_METH_FASTCALL
@@ -18044,7 +18044,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds
18044
18044
  (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
18045
18045
  kw_args--;
18046
18046
  }
18047
- else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3, __pyx_L3_error)
18047
+ else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4, __pyx_L3_error)
18048
18048
  else goto __pyx_L5_argtuple_error;
18049
18049
  CYTHON_FALLTHROUGH;
18050
18050
  case 1:
@@ -18052,14 +18052,14 @@ PyObject *__pyx_args, PyObject *__pyx_kwds
18052
18052
  (void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
18053
18053
  kw_args--;
18054
18054
  }
18055
- else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3, __pyx_L3_error)
18055
+ else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4, __pyx_L3_error)
18056
18056
  else {
18057
- __Pyx_RaiseArgtupleInvalid("cchecksum", 1, 2, 2, 1); __PYX_ERR(0, 3, __pyx_L3_error)
18057
+ __Pyx_RaiseArgtupleInvalid("cchecksum", 1, 2, 2, 1); __PYX_ERR(0, 4, __pyx_L3_error)
18058
18058
  }
18059
18059
  }
18060
18060
  if (unlikely(kw_args > 0)) {
18061
18061
  const Py_ssize_t kwd_pos_args = __pyx_nargs;
18062
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "cchecksum") < 0)) __PYX_ERR(0, 3, __pyx_L3_error)
18062
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "cchecksum") < 0)) __PYX_ERR(0, 4, __pyx_L3_error)
18063
18063
  }
18064
18064
  } else if (unlikely(__pyx_nargs != 2)) {
18065
18065
  goto __pyx_L5_argtuple_error;
@@ -18068,11 +18068,11 @@ PyObject *__pyx_args, PyObject *__pyx_kwds
18068
18068
  values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
18069
18069
  }
18070
18070
  __pyx_v_norm_address_no_0x = ((PyObject*)values[0]);
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)
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, 4, __pyx_L3_error)
18072
18072
  }
18073
18073
  goto __pyx_L6_skip;
18074
18074
  __pyx_L5_argtuple_error:;
18075
- __Pyx_RaiseArgtupleInvalid("cchecksum", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 3, __pyx_L3_error)
18075
+ __Pyx_RaiseArgtupleInvalid("cchecksum", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 4, __pyx_L3_error)
18076
18076
  __pyx_L6_skip:;
18077
18077
  goto __pyx_L4_argument_unpacking_done;
18078
18078
  __pyx_L3_error:;
@@ -18087,7 +18087,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds
18087
18087
  __Pyx_RefNannyFinishContext();
18088
18088
  return NULL;
18089
18089
  __pyx_L4_argument_unpacking_done:;
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)
18090
+ if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_norm_address_no_0x), (&PyUnicode_Type), 1, "norm_address_no_0x", 1))) __PYX_ERR(0, 4, __pyx_L1_error)
18091
18091
  __pyx_r = __pyx_pf_9cchecksum_9_checksum_cchecksum(__pyx_self, __pyx_v_norm_address_no_0x, __pyx_v_address_hash_hex_no_0x);
18092
18092
 
18093
18093
  /* function exit code */
@@ -18127,82 +18127,80 @@ static PyObject *__pyx_pf_9cchecksum_9_checksum_cchecksum(CYTHON_UNUSED PyObject
18127
18127
  int __pyx_clineno = 0;
18128
18128
  __Pyx_TraceFrameInit(__pyx_codeobj__9)
18129
18129
  __Pyx_RefNannySetupContext("cchecksum", 1);
18130
- __Pyx_TraceCall("cchecksum", __pyx_f[0], 3, 0, __PYX_ERR(0, 3, __pyx_L1_error));
18130
+ __Pyx_TraceCall("cchecksum", __pyx_f[0], 4, 0, __PYX_ERR(0, 4, __pyx_L1_error));
18131
18131
 
18132
- /* "cchecksum/_checksum.pyx":30
18132
+ /* "cchecksum/_checksum.pyx":31
18133
18133
  *
18134
18134
  * # Declare memoryviews for fixed-length data
18135
18135
  * cdef const unsigned char[::1] norm_address_mv = norm_address_no_0x.encode('ascii') # <<<<<<<<<<<<<<
18136
18136
  *
18137
18137
  * # Create a buffer for our result
18138
18138
  */
18139
- __Pyx_TraceLine(30,0,__PYX_ERR(0, 30, __pyx_L1_error))
18139
+ __Pyx_TraceLine(31,0,__PYX_ERR(0, 31, __pyx_L1_error))
18140
18140
  if (unlikely(__pyx_v_norm_address_no_0x == Py_None)) {
18141
18141
  PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode");
18142
- __PYX_ERR(0, 30, __pyx_L1_error)
18142
+ __PYX_ERR(0, 31, __pyx_L1_error)
18143
18143
  }
18144
- __pyx_t_1 = PyUnicode_AsASCIIString(__pyx_v_norm_address_no_0x); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 30, __pyx_L1_error)
18144
+ __pyx_t_1 = PyUnicode_AsASCIIString(__pyx_v_norm_address_no_0x); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 31, __pyx_L1_error)
18145
18145
  __Pyx_GOTREF(__pyx_t_1);
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)
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, 31, __pyx_L1_error)
18147
18147
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
18148
18148
  __pyx_v_norm_address_mv = __pyx_t_2;
18149
18149
  __pyx_t_2.memview = NULL;
18150
18150
  __pyx_t_2.data = NULL;
18151
18151
 
18152
- /* "cchecksum/_checksum.pyx":34
18152
+ /* "cchecksum/_checksum.pyx":35
18153
18153
  * # Create a buffer for our result
18154
18154
  * # 2 for "0x" prefix and 40 for the address itself
18155
18155
  * cdef unsigned char[42] buffer = b'0x' + bytearray(40) # <<<<<<<<<<<<<<
18156
18156
  *
18157
18157
  * # Handle character casing based on the hash value
18158
18158
  */
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)
18159
+ __Pyx_TraceLine(35,0,__PYX_ERR(0, 35, __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, 35, __pyx_L1_error)
18161
18161
  __Pyx_GOTREF(__pyx_t_1);
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)
18162
+ __pyx_t_3 = PyNumber_Add(__pyx_kp_b_0x, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 35, __pyx_L1_error)
18163
18163
  __Pyx_GOTREF(__pyx_t_3);
18164
18164
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
18165
- if (unlikely((__Pyx_carray_from_py_unsigned_char(__pyx_t_3, __pyx_t_4, 42) < 0))) __PYX_ERR(0, 34, __pyx_L1_error)
18165
+ if (unlikely((__Pyx_carray_from_py_unsigned_char(__pyx_t_3, __pyx_t_4, 42) < 0))) __PYX_ERR(0, 35, __pyx_L1_error)
18166
18166
  memcpy(&(__pyx_v_buffer[0]), __pyx_t_4, sizeof(__pyx_v_buffer[0]) * (42));
18167
18167
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
18168
18168
 
18169
- /* "cchecksum/_checksum.pyx":40
18169
+ /* "cchecksum/_checksum.pyx":41
18170
18170
  * cdef int address_char
18171
18171
  *
18172
18172
  * for i in range(40): # <<<<<<<<<<<<<<
18173
18173
  *
18174
18174
  * if address_hash_hex_no_0x[i] < 56:
18175
18175
  */
18176
- __Pyx_TraceLine(40,0,__PYX_ERR(0, 40, __pyx_L1_error))
18176
+ __Pyx_TraceLine(41,0,__PYX_ERR(0, 41, __pyx_L1_error))
18177
18177
  for (__pyx_t_5 = 0; __pyx_t_5 < 40; __pyx_t_5+=1) {
18178
18178
  __pyx_v_i = __pyx_t_5;
18179
18179
 
18180
- /* "cchecksum/_checksum.pyx":42
18180
+ /* "cchecksum/_checksum.pyx":43
18181
18181
  * for i in range(40):
18182
18182
  *
18183
18183
  * if address_hash_hex_no_0x[i] < 56: # <<<<<<<<<<<<<<
18184
18184
  * # '0' to '7' have ASCII values 48 to 55
18185
18185
  * buffer[i + 2] = norm_address_mv[i]
18186
18186
  */
18187
- __Pyx_TraceLine(42,0,__PYX_ERR(0, 42, __pyx_L1_error))
18187
+ __Pyx_TraceLine(43,0,__PYX_ERR(0, 43, __pyx_L1_error))
18188
18188
  __pyx_t_6 = __pyx_v_i;
18189
- if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_address_hash_hex_no_0x.shape[0];
18190
18189
  __pyx_t_7 = ((*((unsigned char const *) ( /* dim=0 */ ((char *) (((unsigned char const *) __pyx_v_address_hash_hex_no_0x.data) + __pyx_t_6)) ))) < 56);
18191
18190
  if (__pyx_t_7) {
18192
18191
 
18193
- /* "cchecksum/_checksum.pyx":44
18192
+ /* "cchecksum/_checksum.pyx":45
18194
18193
  * if address_hash_hex_no_0x[i] < 56:
18195
18194
  * # '0' to '7' have ASCII values 48 to 55
18196
18195
  * buffer[i + 2] = norm_address_mv[i] # <<<<<<<<<<<<<<
18197
18196
  *
18198
18197
  * else:
18199
18198
  */
18200
- __Pyx_TraceLine(44,0,__PYX_ERR(0, 44, __pyx_L1_error))
18199
+ __Pyx_TraceLine(45,0,__PYX_ERR(0, 45, __pyx_L1_error))
18201
18200
  __pyx_t_6 = __pyx_v_i;
18202
- if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_norm_address_mv.shape[0];
18203
18201
  (__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)) )));
18204
18202
 
18205
- /* "cchecksum/_checksum.pyx":42
18203
+ /* "cchecksum/_checksum.pyx":43
18206
18204
  * for i in range(40):
18207
18205
  *
18208
18206
  * if address_hash_hex_no_0x[i] < 56: # <<<<<<<<<<<<<<
@@ -18212,27 +18210,26 @@ static PyObject *__pyx_pf_9cchecksum_9_checksum_cchecksum(CYTHON_UNUSED PyObject
18212
18210
  goto __pyx_L5;
18213
18211
  }
18214
18212
 
18215
- /* "cchecksum/_checksum.pyx":47
18213
+ /* "cchecksum/_checksum.pyx":48
18216
18214
  *
18217
18215
  * else:
18218
18216
  * address_char = norm_address_mv[i] # <<<<<<<<<<<<<<
18219
18217
  * # This checks if `address_char` falls in the ASCII range for lowercase hexadecimal
18220
18218
  * # characters ('a' to 'f'), which correspond to ASCII values 97 to 102. If it does,
18221
18219
  */
18222
- __Pyx_TraceLine(47,0,__PYX_ERR(0, 47, __pyx_L1_error))
18220
+ __Pyx_TraceLine(48,0,__PYX_ERR(0, 48, __pyx_L1_error))
18223
18221
  /*else*/ {
18224
18222
  __pyx_t_6 = __pyx_v_i;
18225
- if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_norm_address_mv.shape[0];
18226
18223
  __pyx_v_address_char = (*((unsigned char const *) ( /* dim=0 */ ((char *) (((unsigned char const *) __pyx_v_norm_address_mv.data) + __pyx_t_6)) )));
18227
18224
 
18228
- /* "cchecksum/_checksum.pyx":51
18225
+ /* "cchecksum/_checksum.pyx":52
18229
18226
  * # characters ('a' to 'f'), which correspond to ASCII values 97 to 102. If it does,
18230
18227
  * # the character is capitalized.
18231
18228
  * buffer[i + 2] = address_char - 32 if 97 <= address_char <= 102 else address_char # <<<<<<<<<<<<<<
18232
18229
  *
18233
- * # NOTE: For some reason on some systems the buffer length is longer than 42 here, even though that should not be possible.
18230
+ * # It is faster to decode a buffer with a known size ie buffer[:42]
18234
18231
  */
18235
- __Pyx_TraceLine(51,0,__PYX_ERR(0, 51, __pyx_L1_error))
18232
+ __Pyx_TraceLine(52,0,__PYX_ERR(0, 52, __pyx_L1_error))
18236
18233
  __pyx_t_7 = (97 <= __pyx_v_address_char);
18237
18234
  if (__pyx_t_7) {
18238
18235
  __pyx_t_7 = (__pyx_v_address_char <= 0x66);
@@ -18248,8 +18245,8 @@ static PyObject *__pyx_pf_9cchecksum_9_checksum_cchecksum(CYTHON_UNUSED PyObject
18248
18245
  }
18249
18246
 
18250
18247
  /* "cchecksum/_checksum.pyx":55
18251
- * # NOTE: For some reason on some systems the buffer length is longer than 42 here, even though that should not be possible.
18252
- * # Lucky for us, the first 42 characters are always correct. One day maybe I'll debug this.
18248
+ *
18249
+ * # It is faster to decode a buffer with a known size ie buffer[:42]
18253
18250
  * return buffer[:42].decode('ascii') # <<<<<<<<<<<<<<
18254
18251
  */
18255
18252
  __Pyx_TraceLine(55,0,__PYX_ERR(0, 55, __pyx_L1_error))
@@ -18260,8 +18257,8 @@ static PyObject *__pyx_pf_9cchecksum_9_checksum_cchecksum(CYTHON_UNUSED PyObject
18260
18257
  __pyx_t_3 = 0;
18261
18258
  goto __pyx_L0;
18262
18259
 
18263
- /* "cchecksum/_checksum.pyx":3
18264
- * # cython: boundscheck=False
18260
+ /* "cchecksum/_checksum.pyx":4
18261
+ * # cython: wraparound=False
18265
18262
  *
18266
18263
  * def cchecksum(str norm_address_no_0x, const unsigned char[::1] address_hash_hex_no_0x) -> str: # <<<<<<<<<<<<<<
18267
18264
  * """
@@ -19309,7 +19306,7 @@ static int __Pyx_CreateStringTabAndInitStrings(void) {
19309
19306
  {&__pyx_n_s_cchecksum, __pyx_k_cchecksum, sizeof(__pyx_k_cchecksum), 0, 0, 1, 1},
19310
19307
  {&__pyx_n_s_cchecksum__checksum, __pyx_k_cchecksum__checksum, sizeof(__pyx_k_cchecksum__checksum), 0, 0, 1, 1},
19311
19308
  {&__pyx_kp_s_cchecksum__checksum_pyx, __pyx_k_cchecksum__checksum_pyx, sizeof(__pyx_k_cchecksum__checksum_pyx), 0, 0, 1, 0},
19312
- {&__pyx_kp_u_cchecksum_line_3, __pyx_k_cchecksum_line_3, sizeof(__pyx_k_cchecksum_line_3), 0, 1, 0, 0},
19309
+ {&__pyx_kp_u_cchecksum_line_4, __pyx_k_cchecksum_line_4, sizeof(__pyx_k_cchecksum_line_4), 0, 1, 0, 0},
19313
19310
  {&__pyx_n_s_class, __pyx_k_class, sizeof(__pyx_k_class), 0, 0, 1, 1},
19314
19311
  {&__pyx_n_s_class_getitem, __pyx_k_class_getitem, sizeof(__pyx_k_class_getitem), 0, 0, 1, 1},
19315
19312
  {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
@@ -19395,7 +19392,7 @@ static int __Pyx_CreateStringTabAndInitStrings(void) {
19395
19392
  }
19396
19393
  /* #### Code section: cached_builtins ### */
19397
19394
  static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
19398
- __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 40, __pyx_L1_error)
19395
+ __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 41, __pyx_L1_error)
19399
19396
  __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(1, 83, __pyx_L1_error)
19400
19397
  __pyx_builtin_OverflowError = __Pyx_GetBuiltinName(__pyx_n_s_OverflowError); if (!__pyx_builtin_OverflowError) __PYX_ERR(1, 83, __pyx_L1_error)
19401
19398
  __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(1, 86, __pyx_L1_error)
@@ -19452,14 +19449,14 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
19452
19449
  __Pyx_GOTREF(__pyx_tuple__8);
19453
19450
  __Pyx_GIVEREF(__pyx_tuple__8);
19454
19451
 
19455
- /* "cchecksum/_checksum.pyx":34
19452
+ /* "cchecksum/_checksum.pyx":35
19456
19453
  * # Create a buffer for our result
19457
19454
  * # 2 for "0x" prefix and 40 for the address itself
19458
19455
  * cdef unsigned char[42] buffer = b'0x' + bytearray(40) # <<<<<<<<<<<<<<
19459
19456
  *
19460
19457
  * # Handle character casing based on the hash value
19461
19458
  */
19462
- __pyx_tuple__10 = PyTuple_Pack(1, __pyx_int_40); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 34, __pyx_L1_error)
19459
+ __pyx_tuple__10 = PyTuple_Pack(1, __pyx_int_40); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 35, __pyx_L1_error)
19463
19460
  __Pyx_GOTREF(__pyx_tuple__10);
19464
19461
  __Pyx_GIVEREF(__pyx_tuple__10);
19465
19462
 
@@ -19564,17 +19561,17 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
19564
19561
  __Pyx_GIVEREF(__pyx_tuple__20);
19565
19562
  __pyx_codeobj__21 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__20, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_Enum, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__21)) __PYX_ERR(1, 1, __pyx_L1_error)
19566
19563
 
19567
- /* "cchecksum/_checksum.pyx":3
19568
- * # cython: boundscheck=False
19564
+ /* "cchecksum/_checksum.pyx":4
19565
+ * # cython: wraparound=False
19569
19566
  *
19570
19567
  * def cchecksum(str norm_address_no_0x, const unsigned char[::1] address_hash_hex_no_0x) -> str: # <<<<<<<<<<<<<<
19571
19568
  * """
19572
19569
  * Computes the checksummed version of an Ethereum address.
19573
19570
  */
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)
19571
+ __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, 4, __pyx_L1_error)
19575
19572
  __Pyx_GOTREF(__pyx_tuple__22);
19576
19573
  __Pyx_GIVEREF(__pyx_tuple__22);
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)
19574
+ __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, 4, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__9)) __PYX_ERR(0, 4, __pyx_L1_error)
19578
19575
  __Pyx_RefNannyFinishContext();
19579
19576
  return 0;
19580
19577
  __pyx_L1_error:;
@@ -20638,33 +20635,33 @@ if (!__Pyx_RefNanny) {
20638
20635
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_Enum, __pyx_t_7) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
20639
20636
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
20640
20637
 
20641
- /* "cchecksum/_checksum.pyx":3
20642
- * # cython: boundscheck=False
20638
+ /* "cchecksum/_checksum.pyx":4
20639
+ * # cython: wraparound=False
20643
20640
  *
20644
20641
  * def cchecksum(str norm_address_no_0x, const unsigned char[::1] address_hash_hex_no_0x) -> str: # <<<<<<<<<<<<<<
20645
20642
  * """
20646
20643
  * Computes the checksummed version of an Ethereum address.
20647
20644
  */
20648
- __Pyx_TraceLine(3,0,__PYX_ERR(0, 3, __pyx_L1_error))
20649
- __pyx_t_7 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3, __pyx_L1_error)
20645
+ __Pyx_TraceLine(4,0,__PYX_ERR(0, 4, __pyx_L1_error))
20646
+ __pyx_t_7 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4, __pyx_L1_error)
20650
20647
  __Pyx_GOTREF(__pyx_t_7);
20651
- if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_return, __pyx_n_s_str) < 0) __PYX_ERR(0, 3, __pyx_L1_error)
20652
- __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_9cchecksum_9_checksum_1cchecksum, 0, __pyx_n_s_cchecksum, NULL, __pyx_n_s_cchecksum__checksum, __pyx_d, ((PyObject *)__pyx_codeobj__9)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3, __pyx_L1_error)
20648
+ if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_return, __pyx_n_s_str) < 0) __PYX_ERR(0, 4, __pyx_L1_error)
20649
+ __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_9cchecksum_9_checksum_1cchecksum, 0, __pyx_n_s_cchecksum, NULL, __pyx_n_s_cchecksum__checksum, __pyx_d, ((PyObject *)__pyx_codeobj__9)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4, __pyx_L1_error)
20653
20650
  __Pyx_GOTREF(__pyx_t_4);
20654
20651
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_7);
20655
20652
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
20656
- if (PyDict_SetItem(__pyx_d, __pyx_n_s_cchecksum, __pyx_t_4) < 0) __PYX_ERR(0, 3, __pyx_L1_error)
20653
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_cchecksum, __pyx_t_4) < 0) __PYX_ERR(0, 4, __pyx_L1_error)
20657
20654
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
20658
20655
 
20659
20656
  /* "cchecksum/_checksum.pyx":1
20660
20657
  * # cython: boundscheck=False # <<<<<<<<<<<<<<
20658
+ * # cython: wraparound=False
20661
20659
  *
20662
- * def cchecksum(str norm_address_no_0x, const unsigned char[::1] address_hash_hex_no_0x) -> str:
20663
20660
  */
20664
20661
  __Pyx_TraceLine(1,0,__PYX_ERR(0, 1, __pyx_L1_error))
20665
20662
  __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1, __pyx_L1_error)
20666
20663
  __Pyx_GOTREF(__pyx_t_4);
20667
- if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_cchecksum_line_3, __pyx_kp_u_Computes_the_checksummed_versio) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
20664
+ if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_cchecksum_line_4, __pyx_kp_u_Computes_the_checksummed_versio) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
20668
20665
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_4) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
20669
20666
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
20670
20667
  __Pyx_TraceReturn(Py_None, 0);
@@ -1,4 +1,5 @@
1
1
  # cython: boundscheck=False
2
+ # cython: wraparound=False
2
3
 
3
4
  def cchecksum(str norm_address_no_0x, const unsigned char[::1] address_hash_hex_no_0x) -> str:
4
5
  """
@@ -9,8 +10,8 @@ def cchecksum(str norm_address_no_0x, const unsigned char[::1] address_hash_hex_
9
10
  Improvement Proposal 55 (EIP-55).
10
11
 
11
12
  Args:
12
- norm_address_no_0x (str): The normalized Ethereum address without the '0x' prefix.
13
- address_hash_hex_no_0x (bytes): The hash of the address, also without the '0x' prefix.
13
+ norm_address_no_0x: The normalized Ethereum address without the '0x' prefix.
14
+ address_hash_hex_no_0x: The hash of the address, also without the '0x' prefix.
14
15
 
15
16
  Returns:
16
17
  The checksummed Ethereum address with the '0x' prefix.
@@ -50,6 +51,5 @@ def cchecksum(str norm_address_no_0x, const unsigned char[::1] address_hash_hex_
50
51
  # the character is capitalized.
51
52
  buffer[i + 2] = address_char - 32 if 97 <= address_char <= 102 else address_char
52
53
 
53
- # NOTE: For some reason on some systems the buffer length is longer than 42 here, even though that should not be possible.
54
- # Lucky for us, the first 42 characters are always correct. One day maybe I'll debug this.
54
+ # It is faster to decode a buffer with a known size ie buffer[:42]
55
55
  return buffer[:42].decode('ascii')
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cchecksum
3
- Version: 0.0.10
4
- Summary: A ~2x faster drop-in replacement for eth_utils.to_checksum_address. Raises the exact same Exceptions. Implemented in C.
3
+ Version: 0.0.12
4
+ Summary: A ~4.5x 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
7
7
  Author-email: bobthebuidlerdefi@gmail.com
@@ -13,7 +13,7 @@ setup(
13
13
  "local_scheme": "no-local-version",
14
14
  "version_scheme": "python-simplified-semver",
15
15
  },
16
- description="A ~2x faster drop-in replacement for eth_utils.to_checksum_address. Raises the exact same Exceptions. Implemented in C.",
16
+ description="A ~4.5x faster drop-in replacement for eth_utils.to_checksum_address. Raises the exact same Exceptions. Implemented in C.",
17
17
  author="BobTheBuidler",
18
18
  author_email="bobthebuidlerdefi@gmail.com",
19
19
  url="https://github.com/BobTheBuidler/cchecksum",
@@ -1,7 +0,0 @@
1
- ## CChecksum
2
-
3
- CChecksum is a ~2x faster drop-in replacement for eth_utils.to_checksum_address, with the most cpu-intensive part implemented in c.
4
-
5
- Just `pip install cchecksum`, drop it in, and run your script with a substantial speed improvement.
6
-
7
- ![image](https://github.com/user-attachments/assets/a2da6950-2759-42fa-8a56-7d7e095cd2ce)
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