You are not logged in.

#1 2024-02-29 00:08:34

mptito
Member
Registered: 2024-02-15
Posts: 5

python3 openssl md4 not supported

i have a script here im trying to run to make a test file for datasurgeon app except i get this error

python test.py

"Generating a 5GB test file called 'test.txt'
Traceback (most recent call last):
  File "/root/anaconda3/lib/python3.11/hashlib.py", line 160, in __hash_new
    return _hashlib.new(name, data, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_hashlib.UnsupportedDigestmodError: [digital envelope routines] unsupported

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/max/Downloads/test.py", line 109, in <module>
    main()
  File "/home/max/Downloads/test.py", line 106, in main
    generate_test_file(args.output, args.size, args.speed)
  File "/home/max/Downloads/test.py", line 76, in generate_test_file
    message = generate_message(data_type) + '\n'
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/max/Downloads/test.py", line 60, in generate_message
    return hashlib.new(random.choice(supported_hashes)).hexdigest()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/anaconda3/lib/python3.11/hashlib.py", line 166, in __hash_new
    return __get_builtin_constructor(name)(data)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/anaconda3/lib/python3.11/hashlib.py", line 123, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type md4"


how can i fix this error i have hashlib installed and openssl on latest version of arch.

thank you

Offline

#2 2024-02-29 18:26:10

lmn
Member
Registered: 2021-05-09
Posts: 67

Re: python3 openssl md4 not supported

It seems your code is choosing to use an unsupported hashing algorithm (md4 in this case). The available hashing algorithms depend on openssl and can be checked with

hashlib.algorithms_available

Your code seems choose a hashing algorithm at random, so maybe look into fixing that part (I assume it is a pregenerated list). It is also useful to share the program, so people helping you can give more comprehensive answers and must not resort to guesswork.

MD4 can be reenabled in openssl by editing /etc/ssl/openssl.cnf see https://github.com/openssl/openssl/issues/21247 for more.

[openssl_init]
providers = provider_sect

[provider_sect]
default = default_sect
legacy = legacy_sect

[default_sect]
activate = 1

[legacy_sect]
activate = 1

But be careful with changes to the system ssl as these hashing algorithms are deprecated for a reason.

Edit: changed filename

Last edited by lmn (2024-02-29 18:31:46)

Offline

Board footer

Powered by FluxBB