Title: Fix _hashlib.compare_digest to reject non-ASCII strings by ever0de · Pull Request #7280 · RustPython/RustPython · GitHub
Open Graph Title: Fix _hashlib.compare_digest to reject non-ASCII strings by ever0de · Pull Request #7280 · RustPython/RustPython
X Title: Fix _hashlib.compare_digest to reject non-ASCII strings by ever0de · Pull Request #7280 · RustPython/RustPython
Description: Add non-ASCII string check to _hashlib.compare_digest, matching the behavior of _operator._compare_digest. When both arguments are strings, non-ASCII characters now correctly raise TypeError. Also replace the non-constant-time == comparison with constant_time_eq for proper timing-attack resistance, and return PyResult instead of PyResult. Summary by CodeRabbit Chores Added a dependency to support constant-time cryptographic comparisons. Bug Fixes Digest comparison now yields a direct boolean result and uses constant-time comparison under the hood. Stricter input validation with clearer errors for non-ASCII strings and incompatible/bytes-like inputs.
Open Graph Description: Add non-ASCII string check to _hashlib.compare_digest, matching the behavior of _operator._compare_digest. When both arguments are strings, non-ASCII characters now correctly raise TypeError. Also ...
X Description: Add non-ASCII string check to _hashlib.compare_digest, matching the behavior of _operator._compare_digest. When both arguments are strings, non-ASCII characters now correctly raise TypeError. Also ...
Opengraph URL: https://github.com/RustPython/RustPython/pull/7280
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:f55a6fbc-5388-c090-5736-4407cc2979df |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | A536:210405:8E8E586:BF91CE5:6A5E55A7 |
| html-safe-nonce | 130240fd03ee1a8333c654a1d5cf4889267f49d8064957b1ab9af4b6e9e9856f |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNTM2OjIxMDQwNTo4RThFNTg2OkJGOTFDRTU6NkE1RTU1QTciLCJ2aXNpdG9yX2lkIjoiNTcwMzEyNDkxMjIzODk3NTExIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | b2e28383dfc195d1235693dc2e78a79c982f280b4f0f7925f86e2a3a3ff0e5a3 |
| hovercard-subject-tag | pull_request:3339039325 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/RustPython/RustPython/pull/7280/files |
| twitter:image | https://avatars.githubusercontent.com/u/27040963?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/27040963?s=400&v=4 |
| og:image:alt | Add non-ASCII string check to _hashlib.compare_digest, matching the behavior of _operator._compare_digest. When both arguments are strings, non-ASCII characters now correctly raise TypeError. Also ... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7034b9f0130cdfcbd93bbcf3e8c0f4cc3007af54a2804bfd31f70d472b22852b |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/RustPython/RustPython git https://github.com/RustPython/RustPython.git |
| octolytics-dimension-user_id | 39710557 |
| octolytics-dimension-user_login | RustPython |
| octolytics-dimension-repository_id | 135201145 |
| octolytics-dimension-repository_nwo | RustPython/RustPython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 135201145 |
| octolytics-dimension-repository_network_root_nwo | RustPython/RustPython |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | e75cd8524a0802713165f77a0088258ff9261683 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width