Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make python code a little more pythonic #54

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions proton/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,10 +197,7 @@ def api_request(
fct = self.s.post

if method is None:
if jsondata is None:
fct = self.s.get
else:
fct = self.s.post
fct = self.s.get if jsondata is None else self.s.post
else:
fct = {
"get": self.s.get,
Expand Down
10 changes: 2 additions & 8 deletions proton/srp/_pysrp.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,8 @@ def __init__(self, password, n_bin, g_hex=b"2", bytes_a=None, bytes_A=None): # n
)

self.p = password.encode()
if bytes_a:
self.a = bytes_to_long(bytes_a)
else:
self.a = get_random_of_length(32)
if bytes_A:
self.A = bytes_to_long(bytes_A)
else:
self.A = pow(self.g, self.a, self.N)
self.a = bytes_to_long(bytes_a) if bytes_a else get_random_of_length(32)
self.A = bytes_to_long(bytes_A) if bytes_A else pow(self.g, self.a, self.N)
self.v = None
self.M = None
self.K = None
Expand Down