From 2a89b0c8129eceedfb0db8bdda266ce970c986bc Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Wed, 2 May 2018 05:09:22 +0200 Subject: 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. --- test/util/rpcauth-test.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'test/util') 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') -- cgit v1.2.3