我想将代码更改为基本的G点以生成公共密钥?
import bitcoin
with open("Privkey.txt","r") as f:
content = f.readlines()
# you may also want to remove whitespace characters like `\n` at the end of each line
content = [x.strip() for x in content]
f.close()
outfile = open("Privtopub.txt","w")
for x in content:
outfile.write(x+":"+bitcoin.privtopub(x)+"\n")
outfile.close()
此脚本将导入Bitcoin模块。如您所知,secp256k1使用椭圆曲线上的点:
Gx = 0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798
Gy = 0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8
现在,我需要将这些要点更改为我自己的。让我们承认要点:
Gx = 0xad4f5dc4a9fba25dd7ecb50b0382c29f52c8fc6826e1d5e4c347eec2010e47ed
Gy = 0xbf1e735b3a83b8bee5d60e1bd441e55b425d4b9ef3c1dca7298e829eec33ea4d
我仅在Python 3]上开始编程,不了解这些模块如何更改此代码?
我想将代码更改为基点G以生成公共密钥吗?导入带有open(“ Privkey.txt”,“ r”)为f的比特币:content = f.readlines()#您可能还希望删除空格...
您应该可以使用称为change_curve
的方法。它的签名是