aboutsummaryrefslogtreecommitdiff
path: root/share
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2018-04-16 16:33:39 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2018-04-16 16:34:49 +0200
commit0d6992168c2bda85b18fda8f6dea08da433a0dc9 (patch)
tree780cc6ada12835f6b4e7f6c6255df075de8655ad /share
parent6df0c6cb4169701193868267526eff82be0c5a42 (diff)
parentb95f9a61e0b2ae6cab0ea5431d7ee1841b80a8c8 (diff)
Merge #12993: tests: Remove compatibility code not needed now when we're on Python 3
b95f9a6 tests: Remove compatibility code not needed now when we're on Python 3 (practicalswift) Pull request description: Remove compatibility code not needed now when we're on Python 3. Tree-SHA512: adc6422794ee08ee8d4c69268e74f0d3eb97c7d3c26c9573698c3305572f20d4840cf9f79fd6fbbe367699bbd95533f90fb6d8569b9787f3f9ca20a3f4c75dd7
Diffstat (limited to 'share')
-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:")