code stringlengths 3 6.57k |
|---|
secrets.token_bytes(hf_len) |
bytes_from_octets(aux) |
_det_nonce_(msg_hash, q, Q, aux, ec, hf) |
challenge_(msg_hash: Octets, x_Q: int, x_K: int, ec: Curve, hf: HashF) |
hf() |
bytes_from_octets(msg_hash, hf_len) |
x_K.to_bytes(ec.p_size, byteorder="big", signed=False) |
x_Q.to_bytes(ec.p_size, byteorder="big", signed=False) |
tagged_hash("BIP0340/challenge".encode() |
int_from_bits(t, ec.nlen) |
BTClibRuntimeError("invalid zero challenge") |
_sign_(c: int, q: int, nonce: int, r: int, ec: Curve) |
c (for low-cardinality curves) |
BTClibRuntimeError("invalid zero challenge") |
Sig(r, s, ec) |
specification (not RFC6979) |
hf() |
bytes_from_octets(msg_hash, hf_len) |
gen_keys(prv_key, ec) |
_det_nonce_(msg_hash, q, x_Q, secrets.token_bytes(hf_len) |
gen_keys(nonce, ec) |
challenge_(msg_hash, x_Q, x_K, ec, hf) |
_sign_(c, q, nonce, x_K, ec) |
hf(msg) |
nonce (not RFC6979) |
reduce_to_hlen(msg, hf) |
sign_(msg_hash, prv_key, nonce, ec, hf) |
_assert_as_valid_(c: int, QJ: JacPoint, r: int, s: int, ec: Curve) |
_double_mult(ec.n - c, QJ, s, ec.GJ, ec) |
infinite(KJ) |
ec.y_aff_from_jac(KJ) |
BTClibRuntimeError("y_K is odd") |
BTClibRuntimeError("signature verification failed") |
isinstance(sig, Sig) |
sig.assert_valid() |
Sig.parse(sig) |
point_from_bip340pub_key(Q, sig.ec) |
int(hf(bytes(r) |
bytes(Q) |
challenge_(msg_hash, x_Q, sig.r, sig.ec, hf) |
_assert_as_valid_(c, (x_Q, y_Q, 1) |
reduce_to_hlen(msg, hf) |
assert_as_valid_(msg_hash, Q, sig, hf) |
assert_as_valid_(msg_hash, Q, sig, hf) |
reduce_to_hlen(msg, hf) |
verify_(msg_hash, Q, sig, hf) |
_recover_pub_key_(c: int, r: int, s: int, ec: Curve) |
BTClibRuntimeError("invalid zero challenge") |
ec.y_even(r) |
mod_inv(c, ec.n) |
_double_mult(ec.n - e1, KJ, e1 * s, ec.GJ, ec) |
invalid (INF) |
BTClibRuntimeError(err_msg) |
ec.x_aff_from_jac(QJ) |
isinstance(sig1, Sig) |
sig1.assert_valid() |
Sig.parse(sig1) |
isinstance(sig2, Sig) |
sig2.assert_valid() |
Sig.parse(sig2) |
BTClibValueError("not the same curve in signatures") |
BTClibValueError("not the same r in signatures") |
BTClibValueError("identical signatures") |
point_from_bip340pub_key(Q, ec) |
challenge_(msg_hash1, x_Q, sig1.r, ec, hf) |
challenge_(msg_hash2, x_Q, sig2.r, ec, hf) |
mod_inv(c_2 - c_1, ec.n) |
gen_keys(q) |
gen_keys(nonce) |
reduce_to_hlen(msg1, hf) |
reduce_to_hlen(msg2, hf) |
crack_prv_key_(msg_hash1, sig1, msg_hash2, sig2, Q, hf) |
len(Qs) |
BTClibValueError("no signatures provided") |
len(m_hashes) |
pub_keys ({batch_size}) |
messages ({len(m_hashes) |
BTClibValueError(err_msg) |
len(sigs) |
pub_keys ({batch_size}) |
signatures ({len(sigs) |
BTClibValueError(err_msg) |
assert_as_valid_(m_hashes[0], Qs[0], sigs[0], hf) |
any(sig.ec != ec for sig in sigs) |
BTClibValueError("not the same curve for all signatures") |
enumerate(zip(m_hashes, Qs, sigs) |
bytes_from_octets(msg_hash, hf() |
ec.y_even(sig.r) |
point_from_bip340pub_key(Q, ec) |
challenge_(msg_hash, x_Q, sig.r, ec, hf) |
hash (e.g., SHA256) |
secrets.randbelow(ec.n - 1) |
scalars.append(rand) |
points.append(KJ) |
scalars.append(rand * c % ec.n) |
points.append(QJ) |
_mult(t, ec.GJ, ec) |
_multi_mult(scalars, points, ec) |
if (TJ[0] * RHSZ2 % ec.p != RHSJ[0] * TZ2 % ec.p) |
BTClibRuntimeError("signature verification failed") |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.