-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Implement hashlib.new('sha256') and enable it for CLUE #10740
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Open question: Should this be turned on for other boards/ports? Dan suggested on discord that it might be useful to try turning on the SHA256 option for stuff that already enables hashlib to see if it fits. |
Go ahead and try it. Just set |
|
Just pushed a commit to have the SHA256 option take its default from |
|
Also tried local builds for a couple more nordic boards (nordic port defaults to hashlib off), and they fit fine:
|
|
checks passed. I guess SHA256 fits fine then. |
tannewt
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One small thing. Looks great otherwise!
|
|
||
| CIRCUITPY_HASHLIB = 1 | ||
| CIRCUITPY_HASHLIB_SHA256 = 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need this still? Looks like it fit everywhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree maybe just take this out and take out the guards
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's the bit that lets me actually use it on the board I'm implementing this for as the nordic port doesn't turn hashlib on by default. Are you suggesting maybe do a CIRCUITPY_HASHLIB = 1 at the port level for nordic?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, ok. This is fine then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, maybe @dhalbert is saying to remove CIRCUITPY_HASHLIB_SHA256 which you also don't need. So, leave CIRCUITPY_HASHLIB here but remove the new _SHA256 define.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at ports/nordic/mpconfigport.mk, I see a comment suggesting that space is tight on nrf52833. What if I just enable hashlib in the ifeq ($(MCU_CHIP),nrf52840) section for the nrf52840 boards?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just pushed a couple commits to enable hashlib at the port level for nrf52840 boards (not nrf52833 though) and remove the redundant hashlib enable for CLUE.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, maybe @dhalbert is saying to remove CIRCUITPY_HASHLIB_SHA256 which you also don't need. So, leave CIRCUITPY_HASHLIB here but remove the new _SHA256 define.
This is one of the things I was saying. If hashlib is enabled, don't do finegrain choices on the algorithms right now. I think if there's room for SHA1, there'd be room for SHA256.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so, should I remove the ifdef guard for CIRCUITPY_HASHLIB_SHA256?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, I think you can just get rid of it, if it fits on the Espressif and Pico W.
This turns on hashlib at the port level, but only for nrf52840 boards. There's a comment in mpconfigport.mk suggesting that space is already tight on nrf52833 boards.
This is enabled at the port level now.
|
@dhalbert I've got changes queued up to make the docs look like this: If that looks acceptable, I'll commit and push them. |
|
okay, I went ahead and pushed the commit with the docs fix |
|
now Build CI / docs check is failing, but it looks unrelated, probably? From the build log: |
|
Dan, you've mentioned turning hashlib on for boards that have wifi. From ripgrepping for CIRCUITPY_HASHLIB and CIRCUITPY_WEB_WORKFLOW, cross checked with circuitpython.org included modules lists, it seems the only ports which currently enable hashlib for at least some boards are:
So, that would seem to leave out:
|
|
@samblenny This is fine for now. I mean boards with native wifi. The current ones with I am adding wifi/socketpool/ssl for boards that could support AirLift. I don't think I will need @tannewt #10740 (comment) looks like some kind of type annotation nit in |
Fixed in #10746 |
tannewt
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! I've fixed the docs issue in a separate PR.


The point of this is to:
List of specific changes:
#ifdef CIRCUITPY_HASHLIB_SHA256Checklist:
Test Code: