From b95f9a61e0b2ae6cab0ea5431d7ee1841b80a8c8 Mon Sep 17 00:00:00 2001 From: practicalswift Date: Mon, 16 Apr 2018 09:53:56 +0200 Subject: tests: Remove compatibility code not needed now when we're on Python 3 --- share/rpcauth/rpcauth.py | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'share') 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:") -- cgit v1.2.3