0

my device setup ubuntu22.04, OpenSSL 3.0.2, pyOpenSSL 21.0.0, python2 and python3 both exits. software mainly use python2 as default. NO python-openssl installed. the issue is.

Python 2.7.18 (default, Feb  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

I saw some links which change openssl.cnf, I tested but it only works in python3 env. I want it to work in python2. anyone can help. thanks

MD4 hashlib support in Python 3.8

FYI: python2.7 is enforced due to business , cannot change

nathan
  • 754
  • 1
  • 10
  • 24
  • You could use pycryptodome. While the documentation doesn't mention MD4, it does have code that supports md4. Well, according to this https://lindevs.com/code-snippets/generate-md4-hash-using-python at least. – ewokx Aug 24 '23 at 03:54
  • 2
    If you are worrying about security, then you NEED to consider that Python 2.7 was first released **13 years ago** and has been unsupported for nearly 4 years. – Tim Roberts Aug 24 '23 at 03:56
  • It sounds like md4 is no longer supported. Does md5 work for you? – Tom Karzes Aug 24 '23 at 03:56
  • @TimRoberts hi, python2 is enforced due to business – nathan Aug 24 '23 at 15:29

0 Answers0