Skip to content

Commit ebdb51e

Browse files
authored
assorted minor fixes (#97)
1 parent bdf95e1 commit ebdb51e

File tree

9 files changed

+21
-22
lines changed

9 files changed

+21
-22
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ repos:
7070
language: python
7171
types: [python]
7272
- repo: https://github.com/PyCQA/docformatter
73-
rev: v1.6.0.rc1
73+
rev: v1.5.1
7474
hooks:
7575
- id: docformatter
7676
description: "Formats docstrings to follow PEP 257."

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ without care for backward compatibility; moreover,
3737
some of its algorithms could be broken using side-channel attacks.
3838

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

4545
Included features are:
4646

btclib/ec/curve_group.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -530,9 +530,9 @@ def mult_mont_ladder(m: int, Q: JacPoint, ec: CurveGroup) -> JacPoint:
530530
Jacobian coordinates.
531531
532532
It is constant-time and resistant to the FLUSH+RELOAD attack,
533-
(see
534-
https://eprint.iacr.org/2014/140.pdf)
535533
as it prevents branch prediction avoiding any if.
534+
See:
535+
- https://eprint.iacr.org/2014/140.pdf
536536
537537
The input point is assumed to be on curve and
538538
the m coefficient is assumed to have been reduced mod n

btclib/ecc/bms.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -342,5 +342,5 @@ def verify(msg: Octets, addr: String, sig: Sig | String, lower_s: bool = True) -
342342
assert_as_valid(msg, addr, sig, lower_s)
343343
except Exception: # pylint: disable=broad-except
344344
return False
345-
else:
346-
return True
345+
346+
return True

btclib/ecc/dsa.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -391,8 +391,8 @@ def verify_(
391391
assert_as_valid_(msg_hash, key, sig, lower_s, hf)
392392
except Exception: # pylint: disable=broad-except
393393
return False
394-
else:
395-
return True
394+
395+
return True
396396

397397

398398
def verify(

btclib/ecc/ssa.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,8 +322,8 @@ def verify_(
322322
assert_as_valid_(msg_hash, Q, sig, hf)
323323
except Exception: # pylint: disable=broad-except
324324
return False
325-
else:
326-
return True
325+
326+
return True
327327

328328

329329
def verify(msg: Octets, Q: BIP340PubKey, sig: Sig | Octets, hf: HashF = sha256) -> bool:

btclib/number_theory.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,7 @@ def mod_inv(a: int, m: int) -> int:
4646
m does not have to be a prime.
4747
4848
Based on Extended Euclidean Algorithm, see:
49-
50-
https://en.wikibooks.org/wiki/Algorithm_Implementation/Mathematics/Extended_Euclidean_algorithm
49+
- https://en.wikibooks.org/wiki/Algorithm_Implementation/Mathematics/Extended_Euclidean_algorithm
5150
"""
5251
a %= m
5352
g, x, _ = xgcd(a, m)

btclib/tx/tx.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@
1313
Dataclass encapsulating version, lock_time,
1414
vin (list[TxIn]), and vout (list[TxOut]).
1515
16-
https://en.bitcoin.it/wiki/Transaction
17-
https://learnmeabitcoin.com/guide/coinbase-transaction
18-
https://bitcoin.stackexchange.com/questions/20721/what-is-the-format-of-the-coinbase-transaction
16+
- https://en.bitcoin.it/wiki/Transaction
17+
- https://learnmeabitcoin.com/guide/coinbase-transaction
18+
- https://bitcoin.stackexchange.com/questions/20721/what-is-the-format-of-the-coinbase-transaction
1919
2020
For TxIn.sequence and TX.lock_time see:
21-
https://developer.bitcoin.org/devguide/transactions.html
22-
https://medium.com/summa-technology/bitcoins-time-locks-27e0c362d7a1
23-
https://bitcoin.stackexchange.com/questions/40764/is-my-understanding-of-locktime-correct
24-
https://en.bitcoin.it/wiki/Timelock
21+
- https://developer.bitcoin.org/devguide/transactions.html
22+
- https://medium.com/summa-technology/bitcoins-time-locks-27e0c362d7a1
23+
- https://bitcoin.stackexchange.com/questions/40764/is-my-understanding-of-locktime-correct
24+
- https://en.bitcoin.it/wiki/Timelock
2525
"""
2626

2727
from __future__ import annotations

btclib/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ def int_from_bits(octets: Octets, nlen: int) -> int:
8282
bits on the left, while int_from_bits will discard some bits on the
8383
right. i.to_bytes is the reverse of int_from_bits only when
8484
nlen is a multiple of 8 and bit sequences already have length nlen.
85-
See
86-
https://tools.ietf.org/html/rfc6979#section-2.3.5.
85+
See:
86+
- https://tools.ietf.org/html/rfc6979#section-2.3.5
8787
"""
8888
octets = bytes_from_octets(octets)
8989
i = int.from_bytes(octets, byteorder="big", signed=False)

0 commit comments

Comments
 (0)