I am in a ubuntu22, Openssl 3.0.2, has both python2 and python3. I try to make hashlib.md4 accessible in both python version. Followed the link https://bugs.launchpad.net/ubuntu/+source/python3.10/+bug/1971580/comments/3
but only python3 works, python2 cannot work...I am going mad
xxx# python2
Python 2.7.18 (default, Jul 1 2022, 10:30:50)
[GCC 11.2.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import hashlib
>>> hashlib.new('md4', b"text")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/hashlib.py", line 116, in __py_new
return __get_builtin_constructor(name)(string)
File "/usr/lib/python2.7/hashlib.py", line 97, in __get_builtin_constructor
raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type md4
xxx# python3
Python 3.0.12 (main, Jun 11 2023, 05:26:28) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import hashlib
>>> hashlib.new('md4', b"text")
<md4 _hashlib.HASH object @ 0x7f7169ea0f90>
I don't understand this, looks like the openssl.cnf change cannot be utilized by python2. but I checked python2,python3 env ssl and OpenSSL version, they are both exactly same.
root@yin-mds-437-103:/home/aella# python3
Python 3.10.12 (main, Jun 11 2023, 05:26:28) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ssl
>>> print (ssl.OPENSSL_VERSION)
OpenSSL 3.0.2 15 Mar 2022
>>> import OpenSSL
>>> print (OpenSSL.__version__)
21.0.0
root@yin-mds-437-103:/home/aella# python2
Python 2.7.18 (default, Jul 1 2022, 10:30:50)
[GCC 11.2.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import OpenSSL
/usr/local/lib/python2.7/dist-packages/OpenSSL/crypto.py:14: CryptographyDeprecationWarning: Python 2 is no longer supported by the Python core team. Support for it is now deprecated in cryptography, and will be removed in the next release.
from cryptography import utils, x509
>>>
>>>
>>> print (OpenSSL.__version__)
21.0.0
>>> import ssl
>>> print ssl.OPENSSL_VERSION
OpenSSL 3.0.2 15 Mar 2022
could anyone explain this difference?really need python2 to access this hashlib.md4, much appreciate. Thanks