I see. So, it is not a Ubuntu bug although it is not that obvious.

In short:
1) Some hashing algorithms with MD4 among them were disabled as obsoleted.
2) Cpython shows disabled hashing algorithms as available. Technically it is 
correct because they are can be enabled and used. But it does not mean that 
they can be used right away. Moreover, the exception you get is too generic and 
provides no help whatsoever.


This workaround does the job:

--- /etc/ssl/openssl.cnf.dist   2022-05-04 19:03:33.253072785 +0300
+++ /etc/ssl/openssl.cnf        2022-05-04 19:08:48.828690506 +0300
@@ -56,6 +56,7 @@
 # List of providers to load
 [provider_sect]
 default = default_sect
+legacy = legacy_sect
 # The fips section name should match the section name inside the
 # included fipsmodule.cnf.
 # fips = fips_sect
@@ -71,6 +72,9 @@
 [default_sect]
 # activate = 1
 
+[legacy_sect]
+activate = 1
+

After that MD4 hash started working:

$ python3.10
Python 3.10.4 (main, Apr  2 2022, 09:04:19) [GCC 11.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import hashlib
>>> hashlib.new('md4', b"text")
<md4 _hashlib.HASH object @ 0x7f4636104d30>


Sebastien, thanks a lot!

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1971580

Title:
  md4 hash does not work for Python in Jammy

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/python3.10/+bug/1971580/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to