Developing for Splunk Enterprise

[Python] ValueError: unsupported hash type

Splunk Employee
Splunk Employee

I have found that on some of my instances and later versions of splunk that have version 2.7 of Python bundled, when trying to execute my python scripts using splunk's bundled python libraries, i get the following error and the script does not execute.

"/Applications/splunk6.2/splunk/lib/python2.7/hashlib.py", line 139, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/Applications/splunk6.2/splunk/lib/python2.7/hashlib.py", line 91, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type md5
ERROR:root:code for hash sha1 was not found.
Traceback (most recent call last):
  File "/Applications/splunk6.2/splunk/lib/python2.7/hashlib.py", line 139, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/Applications/splunk6.2/splunk/lib/python2.7/hashlib.py", line 91, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha1
ERROR:root:code for hash sha224 was not found.
Traceback (most recent call last):
  File "/Applications/splunk6.2/splunk/lib/python2.7/hashlib.py", line 139, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/Applications/splunk6.2/splunk/lib/python2.7/hashlib.py", line 91, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha224
ERROR:root:code for hash sha256 was not found.
Traceback (most recent call last):
  File "/Applications/splunk6.2/splunk/lib/python2.7/hashlib.py", line 139, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/Applications/splunk6.2/splunk/lib/python2.7/hashlib.py", line 91, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha256
ERROR:root:code for hash sha384 was not found.
Traceback (most recent call last):
  File "/Applications/splunk6.2/splunk/lib/python2.7/hashlib.py", line 139, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/Applications/splunk6.2/splunk/lib/python2.7/hashlib.py", line 91, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha384
ERROR:root:code for hash sha512 was not found.
Traceback (most recent call last):
  File "/Applications/splunk6.2/splunk/lib/python2.7/hashlib.py", line 139, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/Applications/splunk6.2/splunk/lib/python2.7/hashlib.py", line 91, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha512

How can i fix this error?

1 Solution

Builder

This is because The python2.7 package is dependent to the libssl1_0_0 package (openssl_1.0 runtime librairies). Your OS is missing these. Install them and it will get rid of this error.

View solution in original post

Builder

I marked this as a "me too", however, it seems that while python dumps out these messages, the script continues on and does what it is supposed to do. So, it's just noise rather than broken for me.

0 Karma

Builder

This is because The python2.7 package is dependent to the libssl1_0_0 package (openssl_1.0 runtime librairies). Your OS is missing these. Install them and it will get rid of this error.

View solution in original post

Explorer

Wouldn't using openssl_1.0, make you vulnerable to "Heartbleed"?

Communicator

Yes. A better answer would be "just don't do anything ssl-related with splunk's built-in python"

0 Karma