aboutsummaryrefslogtreecommitdiff
path: root/share/rpcauth
diff options
context:
space:
mode:
authorpracticalswift <practicalswift@users.noreply.github.com>2018-04-16 09:53:56 +0200
committerpracticalswift <practicalswift@users.noreply.github.com>2018-04-16 09:54:27 +0200
commitb95f9a61e0b2ae6cab0ea5431d7ee1841b80a8c8 (patch)
tree780cc6ada12835f6b4e7f6c6255df075de8655ad /share/rpcauth
parent6df0c6cb4169701193868267526eff82be0c5a42 (diff)
tests: Remove compatibility code not needed now when we're on Python 3
Diffstat (limited to 'share/rpcauth')
-rwxr-xr-xshare/rpcauth/rpcauth.py11
1 files changed, 2 insertions, 9 deletions
diff --git a/share/rpcauth/rpcauth.py b/share/rpcauth/rpcauth.py
index d6580281d4..10cf516732 100755
--- a/share/rpcauth/rpcauth.py
+++ b/share/rpcauth/rpcauth.py
@@ -3,7 +3,6 @@
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
-import hashlib
import sys
import os
from random import SystemRandom
@@ -25,15 +24,9 @@ hexseq = list(map(hex, salt_sequence))
salt = "".join([x[2:] for x in hexseq])
#Create 32 byte b64 password
-password = base64.urlsafe_b64encode(os.urandom(32))
-
-digestmod = hashlib.sha256
-
-if sys.version_info.major >= 3:
- password = password.decode('utf-8')
- digestmod = 'SHA256'
+password = base64.urlsafe_b64encode(os.urandom(32)).decode("utf-8")
-m = hmac.new(bytearray(salt, 'utf-8'), bytearray(password, 'utf-8'), digestmod)
+m = hmac.new(bytearray(salt, 'utf-8'), bytearray(password, 'utf-8'), "SHA256")
result = m.hexdigest()
print("String to be appended to bitcoin.conf:")