Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-85283: Build md5 extension with limited C API#110967

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
vstinner merged 1 commit intopython:mainfromvstinner:limited_md5
Oct 17, 2023

Conversation

vstinner
Copy link
Member

@vstinnervstinner commentedOct 17, 2023
edited by github-actionsbot
Loading

  • Replace _Py_strhex() with few lines of code.
  • Replace _PyType_GetModuleState() with PyType_GetModuleState().

📚 Documentation preview 📚:https://cpython-previews--110967.org.readthedocs.build/

@vstinner
Copy link
MemberAuthor

Replace _Py_strhex() with few lines of code.

For now, I prefer to not add such function to the public C API, since users may want many variants:

  • Uppercase letters
  • Space separator
  • Get a bytes object instead of a str object

See Include/internal/pycore_strhex.h: there are 4 functions with different arguments.

* Replace _Py_strhex() with few lines of code.* Replace _PyType_GetModuleState() with PyType_GetModuleState().* Fix make check-c-globals
@vstinner
Copy link
MemberAuthor

The_md5 extension is not used in practice:

vstinner@mona$ ./pythonPython3.13.0a1+ (heads/limited_md5-dirty:417055ae80,Oct172023,12:28:44) [GCC13.2.120231011 (RedHat13.2.1-4)]onlinuxType"help","copyright","credits"or"license"formoreinformation.>>>import_md5>>>h1=_md5.md5(b'Python')>>>type(h1).__module__'_md5'>>>importhashlib>>>h2=hashlib.new('md5',b'Python')>>>type(h2).__module__'_hashlib'>>>h1.digest()==h2.digest()True

hashlib uses the OpenSSL implementation of MD5. The_md5 extension is only used when OpenSSL is missing, which should not be the case on Linux, Windows, macOS, FreeBSD, etc.

@vstinnervstinner merged commit4dba0a6 intopython:mainOct 17, 2023
@vstinnervstinner deleted the limited_md5 branchOctober 17, 2023 10:57
aisk pushed a commit to aisk/cpython that referenced this pull requestFeb 11, 2024
* Replace _Py_strhex() with few lines of code.* Replace _PyType_GetModuleState() with PyType_GetModuleState().* Fix make check-c-globals.
Glyphack pushed a commit to Glyphack/cpython that referenced this pull requestSep 2, 2024
* Replace _Py_strhex() with few lines of code.* Replace _PyType_GetModuleState() with PyType_GetModuleState().* Fix make check-c-globals.
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@tirantiranAwaiting requested review from tirantiran is a code owner

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

1 participant
@vstinner

[8]ページ先頭

©2009-2025 Movatter.jp