summaryrefslogtreecommitdiff
path: root/dns/entropy.py
diff options
context:
space:
mode:
authorBob Halley <halley@dnspython.org>2020-05-01 12:13:35 -0700
committerBob Halley <halley@dnspython.org>2020-05-01 12:13:35 -0700
commitf8ec9f65512ae749c8f4f5e67947a7cee41db7e5 (patch)
tree0ae69b4cc75c7a4c74ceea1db636e40558e68915 /dns/entropy.py
parent9a691ed319dd43bf897d83e01e75e407e6500d25 (diff)
downloaddnspython-f8ec9f65512ae749c8f4f5e67947a7cee41db7e5.tar.gz
remove obsolete entropy pool hash import logic
Diffstat (limited to 'dns/entropy.py')
-rw-r--r--dns/entropy.py18
1 files changed, 4 insertions, 14 deletions
diff --git a/dns/entropy.py b/dns/entropy.py
index 3b4194e..da4332c 100644
--- a/dns/entropy.py
+++ b/dns/entropy.py
@@ -16,12 +16,13 @@
# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
import os
+import hashlib
import random
import time
try:
import threading as _threading
except ImportError:
- import dummy_threading as _threading
+ import dummy_threading as _threading # type: ignore
class EntropyPool(object):
@@ -36,19 +37,8 @@ class EntropyPool(object):
self.digest = None
self.next_byte = 0
self.lock = _threading.Lock()
- try:
- import hashlib
- self.hash = hashlib.sha1()
- self.hash_len = 20
- except ImportError:
- try:
- import sha
- self.hash = sha.new()
- self.hash_len = 20
- except ImportError:
- import md5 # pylint: disable=import-error
- self.hash = md5.new()
- self.hash_len = 16
+ self.hash = hashlib.sha1()
+ self.hash_len = 20
self.pool = bytearray(b'\0' * self.hash_len)
if seed is not None:
self.stir(bytearray(seed))