Skip to content

Commit 7040a20

Browse files
committed
doc: fix sage code for deriving alternative generator H
The expression `G.decode('hex')` fails with the following error message on Sage 9.5: AttributeError: 'str' object has no attribute 'decode' Fix that by converting the hex-string to bytes using `bytes.fromhex`.
1 parent a7907b1 commit 7040a20

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/modules/generator/main_impl.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
import hashlib
2525
F = FiniteField (0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F)
2626
G = '0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8'
27-
H = EllipticCurve ([F (0), F (7)]).lift_x(F(int(hashlib.sha256(G.decode('hex')).hexdigest(),16)))
27+
H = EllipticCurve ([F (0), F (7)]).lift_x(F(int(hashlib.sha256(bytes.fromhex(G)).hexdigest(),16)))
2828
print('%x %x' % H.xy())
2929
*/
3030
static const secp256k1_generator secp256k1_generator_h_internal = {{

0 commit comments

Comments
 (0)