Skip to content

Conversation

@samblenny
Copy link

@samblenny samblenny commented Dec 5, 2025

The point of this is to:

  1. Make it possible to use a CLUE board as a TOTP token that supports the SHA1 and SHA256 hash algorithm options for fast updating (pure python hashes take 2+ seconds)
  2. Add optional SHA256 support to hashlib that can be used by other things that need it (e.g. CircuitMatter)

List of specific changes:

  1. Implement 'sha256' option for hashlib.new()
  2. Gate SHA256 stuff behind #ifdef CIRCUITPY_HASHLIB_SHA256
  3. Enable hashlib with 'sha1' and 'sha256' for ports/nordic/clue_nrf52840_express

Checklist:

  • pre-commit passed
  • builds without errors
  • test code runs on CLUE board with same results as CPython

Test Code:

Adafruit CircuitPython 10.1.0-beta.1-5-g108860a837-dirty on 2025-12-05; Adafruit CLUE nRF52840 Express with nRF52840
>>> import hashlib
>>> s1 = hashlib.new('sha1', b'SHA1 Hash')
>>> s2 = hashlib.new('sha256', b'SHA256 Hash')
>>> s1.digest().hex()
'a28191ff62cce66838e67c16dd48ab118c27b417'
>>> s2.digest().hex()
'2023b38445ae586b672848c31e3e13883f17fd07531c9aa2b8f212b3b7a0d11f'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant