From 184fd239ff86c9680747eb45e2418f809a1f85c4 Mon Sep 17 00:00:00 2001 From: Colinxu2020 Date: Tue, 16 Jul 2024 19:30:48 +0800 Subject: [PATCH] add types --- slhdsa/lowlevel/slhdsa.py | 2 +- slhdsa/slhdsa.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/slhdsa/lowlevel/slhdsa.py b/slhdsa/lowlevel/slhdsa.py index f5c092d..ebb2578 100644 --- a/slhdsa/lowlevel/slhdsa.py +++ b/slhdsa/lowlevel/slhdsa.py @@ -19,7 +19,7 @@ def keygen(par: Parameter) -> tuple[tuple[bytes, bytes, bytes, bytes], tuple[byt def validate_secretkey(secret_key: tuple[bytes, bytes, bytes, bytes], par: Parameter) -> bool: sk_seed, sk_prf, pk_seed, pk_root = secret_key - # len(sk_prf) # magic patch for mypyc, otherwise mypyc will crash + len(sk_prf) # magic patch for mypyc, otherwise mypyc will crash address = Address(par.d - 1, 0, 0) pk_root_new = XMSS(par).node(sk_seed, 0, par.h_m, pk_seed, address) return pk_root == pk_root_new diff --git a/slhdsa/slhdsa.py b/slhdsa/slhdsa.py index 6bbcd40..a4ec52d 100644 --- a/slhdsa/slhdsa.py +++ b/slhdsa/slhdsa.py @@ -25,7 +25,7 @@ def from_digest(cls, digest: bytes, par: Parameter) -> "PublicKey": raise exc.SLHDSAKeyException('Wrong digest length') return cls((digest[:par.n], digest[par.n:]), par) - def __str__(self): + def __str__(self) -> str: return f'' @@ -55,7 +55,7 @@ def from_digest(cls, digest: bytes, par: Parameter) -> "SecretKey": raise exc.SLHDSAKeyException("Wrong digest length") return cls((digest[:par.n], digest[par.n:par.n*2], digest[par.n*2:par.n*3], digest[par.n*3:]), par) - def __str__(self): + def __str__(self) -> str: return f''