aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2018-05-02 12:15:25 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2018-05-02 12:15:28 +0200
commit0bc980b1f65f3739bb9667d58abab1137c0f942a (patch)
treef3a45cae5440036c8b13324e3d2794c7b8d867e1 /test
parent57c57df86f14874cfc4b280e04a7f44b19839c26 (diff)
parent2a89b0c8129eceedfb0db8bdda266ce970c986bc (diff)
downloadbitcoin-0bc980b1f65f3739bb9667d58abab1137c0f942a.tar.xz
Merge #13146: rpcauth: Make it possible to provide a custom password
2a89b0c rpcauth: Make it possible to provide a custom password (Wladimir J. van der Laan) Pull request description: This adds the functionality to specify a custom password to `rpcauth.py`, as well as makes the code (IMO) easier to understand. Tree-SHA512: 458d54cc258e16917c0f0ce5ae1c3d6c0c03b5ab931011bf3feb09a3474f1511c38ec45822a4af2aadeaca522a002ba04a564849dd3f42fa6f36dd21b0cba093
Diffstat (limited to 'test')
-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')