aboutsummaryrefslogtreecommitdiff
path: root/test/util
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2018-05-02 05:09:22 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2018-05-02 05:29:22 +0200
commit2a89b0c8129eceedfb0db8bdda266ce970c986bc (patch)
treef3a45cae5440036c8b13324e3d2794c7b8d867e1 /test/util
parent57c57df86f14874cfc4b280e04a7f44b19839c26 (diff)
downloadbitcoin-2a89b0c8129eceedfb0db8bdda266ce970c986bc.tar.xz
rpcauth: Make it possible to provide a custom password
This adds the functionality to specify a custom password to `rpcauth.py`, as well as makes the code (IMO) easier to understand.
Diffstat (limited to 'test/util')
-rwxr-xr-xtest/util/rpcauth-test.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/test/util/rpcauth-test.py b/test/util/rpcauth-test.py
index dfbb5ea3a7..2456feb102 100755
--- a/test/util/rpcauth-test.py
+++ b/test/util/rpcauth-test.py
@@ -28,16 +28,15 @@ class TestRPCAuth(unittest.TestCase):
self.assertGreaterEqual(len(self.rpcauth.generate_salt()), 16)
def test_generate_password(self):
- salt = self.rpcauth.generate_salt()
- password, password_hmac = self.rpcauth.generate_password(salt)
-
+ password = self.rpcauth.generate_password()
expected_password = base64.urlsafe_b64encode(
base64.urlsafe_b64decode(password)).decode('utf-8')
self.assertEqual(expected_password, password)
def test_check_password_hmac(self):
salt = self.rpcauth.generate_salt()
- password, password_hmac = self.rpcauth.generate_password(salt)
+ password = self.rpcauth.generate_password()
+ password_hmac = self.rpcauth.password_to_hmac(salt, password)
m = hmac.new(bytearray(salt, 'utf-8'),
bytearray(password, 'utf-8'), 'SHA256')