mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-26 05:48:20 +01:00
tests: Remove compatibility code not needed now when we're on Python 3
This commit is contained in:
@@ -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:")
|
||||
|
||||
Reference in New Issue
Block a user