Time taken to add points changes to around 35% of what it was with python-ecdsa
Backport of:
- https://github.com/spesmilo/electrum/commit/65d896be5a646e9c0650feaba0ddd36de4833918
- https://github.com/spesmilo/electrum/commit/1669dd97827951d330b87bb6d7f786d843504766
See also [[https://github.com/Electron-Cash/Electron-Cash/pull/1621 | electroncash#1621]]
Benchmark:
```
import os
import time
from electrumabc.ecc import GENERATOR
from electrumabc.crypto import sha256
rand_bytes = os.urandom(32)
point_pairs = []
for i in range(30000):
rand_bytes = sha256(rand_bytes)
rand_int = int.from_bytes(rand_bytes, "big")
a = generator() * rand_int
rand_bytes = sha256(rand_bytes)
rand_int = int.from_bytes(rand_bytes, "big")
b = generator() * rand_int
point_pairs.append((a,b))
t0 = time.time()
for a, b in point_pairs:
c = a + b
t = time.time() - t0
print(f"time taken: {t:.4f} seconds")
```
Before: time taken: 1.0946 seconds
After: time taken: 0.5168 seconds