Skip to content
Snippets Groups Projects

Typo pep8

Merged Moul requested to merge typo_pep8 into master
6 files
+ 211
144
Compare changes
  • Side-by-side
  • Inline
Files
6
+ 10
7
@@ -2,6 +2,7 @@ from tools import *
import getpass
import os
def auth_method(c):
if c.contains_switches('auth-scrypt'):
return auth_by_scrypt()
@@ -12,16 +13,18 @@ def auth_method(c):
print("Error: no authentication method")
exit()
def generate_auth_file(c):
if c.contains_definitions('file'):
file = c.get_definition('file')
else:
file = "authfile"
seed = auth_method(c)
with open(file, "w") as f:
with open(file, "w") as f:
f.write(seed)
print("Authfile generated for the public key: ", get_publickey_from_seed(seed))
def auth_by_auth_file(c):
if c.contains_definitions('file'):
file = c.get_definition('file')
@@ -30,14 +33,15 @@ def auth_by_auth_file(c):
if not os.path.isfile(file):
print("Error: the file \"" + file + "\" does not exist")
exit()
with open(file) as f:
seed = f.read()
with open(file) as f:
seed = f.read()
regex = re.compile('^[0-9a-fA-F]{64}$')
if not re.search(regex, seed):
print("Error: the format of the file is invalid")
exit()
return seed
def auth_by_seed():
seed = input("Please enter your seed on hex format: ")
regex = re.compile('^[0-9a-fA-F]{64}$')
@@ -50,15 +54,14 @@ def auth_by_seed():
def auth_by_scrypt():
salt = input("Please enter your Scrypt Salt (Secret identifier): ")
password = getpass.getpass("Please enter your Scrypt password (masked): ")
scrypt_param = input("Please enter your Scrypt parameters (N,r,p): [4096,16,1]")
scrypt_param = input("Please enter your Scrypt parameters (N,r,p): default [4096,16,1]: ")
if not scrypt_param:
scrypt_param = "4096,16,1"
scrypt_param_splited= scrypt_param.split(",")
scrypt_param_splited = scrypt_param.split(",")
n = int(scrypt_param_splited[0])
r = int(scrypt_param_splited[1])
p = int(scrypt_param_splited[2])
if (n <= 0 or n > 65536 or r <= 0 or r > 512 or p <= 0 or p > 32):
print("Error: the values of Scrypt parameters are not good")
seed = get_seed_from_scrypt(salt, password, n, r, p)
return seed
return get_seed_from_scrypt(salt, password, n, r, p)
Loading