Skip to content

Commit

Permalink
Merge a162eba into bdf95e1
Browse files Browse the repository at this point in the history
  • Loading branch information
fametrano committed Jan 29, 2023
2 parents bdf95e1 + a162eba commit 3d6776e
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ repos:
language: python
types: [python]
- repo: https://github.com/PyCQA/docformatter
rev: v1.6.0.rc1
rev: v1.5.1
hooks:
- id: docformatter
description: "Formats docstrings to follow PEP 257."
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ without care for backward compatibility; moreover,
some of its algorithms could be broken using side-channel attacks.

The library is not limited to the bitcon elliptic curve secp256k1;
anyway, for this curve FFI bindings to
anyway, FFI bindings to
[libsecp256k1](https://github.com/bitcoin-core/secp256k1)
(the optimized C library used by Bitcoin Core)
are available and used by default.
are available for this curve and used by default.

Included features are:

Expand Down
4 changes: 2 additions & 2 deletions btclib/ec/curve_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -530,9 +530,9 @@ def mult_mont_ladder(m: int, Q: JacPoint, ec: CurveGroup) -> JacPoint:
Jacobian coordinates.
It is constant-time and resistant to the FLUSH+RELOAD attack,
(see
https://eprint.iacr.org/2014/140.pdf)
as it prevents branch prediction avoiding any if.
See:
- https://eprint.iacr.org/2014/140.pdf
The input point is assumed to be on curve and
the m coefficient is assumed to have been reduced mod n
Expand Down
4 changes: 2 additions & 2 deletions btclib/ecc/bms.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,5 +342,5 @@ def verify(msg: Octets, addr: String, sig: Sig | String, lower_s: bool = True) -
assert_as_valid(msg, addr, sig, lower_s)
except Exception: # pylint: disable=broad-except
return False
else:
return True

return True
4 changes: 2 additions & 2 deletions btclib/ecc/dsa.py
Original file line number Diff line number Diff line change
Expand Up @@ -391,8 +391,8 @@ def verify_(
assert_as_valid_(msg_hash, key, sig, lower_s, hf)
except Exception: # pylint: disable=broad-except
return False
else:
return True

return True


def verify(
Expand Down
4 changes: 2 additions & 2 deletions btclib/ecc/ssa.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,8 +322,8 @@ def verify_(
assert_as_valid_(msg_hash, Q, sig, hf)
except Exception: # pylint: disable=broad-except
return False
else:
return True

return True


def verify(msg: Octets, Q: BIP340PubKey, sig: Sig | Octets, hf: HashF = sha256) -> bool:
Expand Down
3 changes: 1 addition & 2 deletions btclib/number_theory.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ def mod_inv(a: int, m: int) -> int:
m does not have to be a prime.
Based on Extended Euclidean Algorithm, see:
https://en.wikibooks.org/wiki/Algorithm_Implementation/Mathematics/Extended_Euclidean_algorithm
- https://en.wikibooks.org/wiki/Algorithm_Implementation/Mathematics/Extended_Euclidean_algorithm
"""
a %= m
g, x, _ = xgcd(a, m)
Expand Down
14 changes: 7 additions & 7 deletions btclib/tx/tx.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@
Dataclass encapsulating version, lock_time,
vin (list[TxIn]), and vout (list[TxOut]).
https://en.bitcoin.it/wiki/Transaction
https://learnmeabitcoin.com/guide/coinbase-transaction
https://bitcoin.stackexchange.com/questions/20721/what-is-the-format-of-the-coinbase-transaction
- https://en.bitcoin.it/wiki/Transaction
- https://learnmeabitcoin.com/guide/coinbase-transaction
- https://bitcoin.stackexchange.com/questions/20721/what-is-the-format-of-the-coinbase-transaction
For TxIn.sequence and TX.lock_time see:
https://developer.bitcoin.org/devguide/transactions.html
https://medium.com/summa-technology/bitcoins-time-locks-27e0c362d7a1
https://bitcoin.stackexchange.com/questions/40764/is-my-understanding-of-locktime-correct
https://en.bitcoin.it/wiki/Timelock
- https://developer.bitcoin.org/devguide/transactions.html
- https://medium.com/summa-technology/bitcoins-time-locks-27e0c362d7a1
- https://bitcoin.stackexchange.com/questions/40764/is-my-understanding-of-locktime-correct
- https://en.bitcoin.it/wiki/Timelock
"""

from __future__ import annotations
Expand Down
4 changes: 2 additions & 2 deletions btclib/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ def int_from_bits(octets: Octets, nlen: int) -> int:
bits on the left, while int_from_bits will discard some bits on the
right. i.to_bytes is the reverse of int_from_bits only when
nlen is a multiple of 8 and bit sequences already have length nlen.
See
https://tools.ietf.org/html/rfc6979#section-2.3.5.
See:
- https://tools.ietf.org/html/rfc6979#section-2.3.5
"""
octets = bytes_from_octets(octets)
i = int.from_bytes(octets, byteorder="big", signed=False)
Expand Down

0 comments on commit 3d6776e

Please sign in to comment.