Skip to content

Conversation

@kyoungbinkim
Copy link
Contributor

@kyoungbinkim kyoungbinkim commented Jan 25, 2026

Add Ethereum address detection to CryptoRecognizer

Summary

Extends CryptoRecognizer to detect and validate Ethereum (ETH) addresses using EIP-55 checksum validation.

Ref

Changes

  • Added ETH address pattern recognition (0x[a-fA-F0-9]{40})
  • Implemented EIP-55 checksum validation using Keccak-256
  • Added eth-hash[pycryptodome] dependency
  • Added comprehensive test cases for ETH addresses

Testing

  • All existing tests pass
  • Added 5+ test cases for ETH validation (valid/invalid checksums)
❯ ruff check .
All checks passed!
❯ poetry run pytest tests/test_crypto_recognizer.py
================================ test session starts ================================
platform linux -- Python 3.12.3, pytest-9.0.2, pluggy-1.6.0
rootdir: /home/kbin/workspace/presidio/presidio-analyzer
configfile: pyproject.toml
plugins: anyio-4.12.1, cov-7.0.0, mock-3.15.1
collected 15 items                                                                  

tests/test_crypto_recognizer.py ...............                               [100%]

================================= warnings summary ==================================
../.venv/lib/python3.12/site-packages/torch/jit/_script.py:1480
../.venv/lib/python3.12/site-packages/torch/jit/_script.py:1480
../.venv/lib/python3.12/site-packages/torch/jit/_script.py:1480
../.venv/lib/python3.12/site-packages/torch/jit/_script.py:1480
../.venv/lib/python3.12/site-packages/torch/jit/_script.py:1480
../.venv/lib/python3.12/site-packages/torch/jit/_script.py:1480
../.venv/lib/python3.12/site-packages/torch/jit/_script.py:1480
  /home/kbin/workspace/presidio/.venv/lib/python3.12/site-packages/torch/jit/_script.py:1480: DeprecationWarning: `torch.jit.script` is deprecated. Please switch to `torch.compile` or `torch.export`.
    warnings.warn(

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
========================== 15 passed, 7 warnings in 0.13s ===========================

Checklist

  • I have reviewed the contribution guidelines
  • I have signed the CLA (if required)
  • My code includes unit tests
  • All unit tests and lint checks pass locally
  • My PR contains documentation updates / additions if required

@kyoungbinkim kyoungbinkim requested a review from a team as a code owner January 25, 2026 07:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant