Changeset View
Changeset View
Standalone View
Standalone View
share/rpcauth/rpcauth.py
#!/usr/bin/env python3 | #!/usr/bin/env python3 | ||||
# Copyright (c) 2015-2018 The Bitcoin Core developers | # Copyright (c) 2015-2018 The Bitcoin Core developers | ||||
# Distributed under the MIT software license, see the accompanying | # Distributed under the MIT software license, see the accompanying | ||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php. | # file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
import hmac | |||||
from argparse import ArgumentParser | from argparse import ArgumentParser | ||||
from base64 import urlsafe_b64encode | from base64 import urlsafe_b64encode | ||||
from binascii import hexlify | from binascii import hexlify | ||||
from getpass import getpass | from getpass import getpass | ||||
from os import urandom | from os import urandom | ||||
import hmac | |||||
def generate_salt(size): | def generate_salt(size): | ||||
"""Create size byte hex salt""" | """Create size byte hex salt""" | ||||
return hexlify(urandom(size)).decode() | return hexlify(urandom(size)).decode() | ||||
def generate_password(): | def generate_password(): | ||||
"""Create 32 byte b64 password""" | """Create 32 byte b64 password""" | ||||
Show All 33 Lines |