chore: code format

This commit is contained in:
Vlad Stan 2022-10-12 08:03:23 +03:00
parent 8f40422f88
commit 6accf8f7ee
3 changed files with 14 additions and 16 deletions

View File

@ -30,17 +30,17 @@ import hashlib
from secp256k1 import PrivateKey, PublicKey
def hash_to_curve(message: bytes):
"""Generates a point from the message hash and checks if the point lies on the curve.
If it does not, it tries computing again a new x coordinate from the hash of the coordinate."""
point = None
msg_to_hash = message
while point is None:
try:
_hash = hashlib.sha256(msg_to_hash).digest()
point = PublicKey(b"\x02" + _hash, raw=True)
except:
msg_to_hash = _hash
def hash_to_curve(message: bytes):
"""Generates a point from the message hash and checks if the point lies on the curve.
If it does not, it tries computing again a new x coordinate from the hash of the coordinate."""
point = None
msg_to_hash = message
while point is None:
try:
_hash = hashlib.sha256(msg_to_hash).digest()
point = PublicKey(b"\x02" + _hash, raw=True)
except:
msg_to_hash = _hash
return point

View File

@ -1,5 +1,5 @@
import hashlib
import base64
import hashlib
from typing import List, Set
from .core.b_dhke import verify
@ -41,13 +41,11 @@ async def verify_proof(master_prvkey: str, proofs_used: Set[str], proof: Proof):
] # Get the correct key to check against
C = PublicKey(bytes.fromhex(proof.C), raw=True)
secret = base64.standard_b64decode(proof.secret)
print('### secret', secret)
print("### secret", secret)
validMintSig = verify(secret_key, C, secret)
if validMintSig != True:
raise Exception(f"tokens not valid. Secret: {proof.secret}")
def verify_split_amount(amount: int):
"""Split amount like output amount can't be negative or too big."""

View File

@ -1089,7 +1089,7 @@ page_container %}
payload
)
newTokens.promises = data.snd;
newTokens.promises = data.snd
// console.log('split data', JSON.stringify(data.snd))
// for (let i =0 ;i < newTokens.length; i++) {
// Object.assign(newTokens[i], promises)