Package: secp256k2
SECP256k2: A Modern Library for Elliptic Curve CryptographyIntroductionSECP256k2is a high-performance and easy-to-use library for working with the SECP256k1 elliptic curve. This library is meticulously designed to provide a robust set of functionalities needed for the development of secure, fast, and efficient cryptographic applications.FeaturesOptimized Performance:Leveraging optimized algorithms and efficient code structures for high-speed operations on the SECP256k1 curve.Comprehensive Toolset:Offering a wide array of functionalities ranging from basic arithmetic operations to advanced cryptographic protocols.Cross-Platform:Written inC&Python,SECP256k2is designed to be used on multiple operating systems including Windows and Linux & Mac.Getting StartedInstallationwindows withpippipinstall--upgradesecp256k2linux and Mac withpip3pip3install--upgradesecp256k2Generate and Converet 10,000 Key to Compress and Uncompress Address. ( Check Now inGoogle Colab)importos,timeitsetup_code="""from os import urandomfrom secp256k2 import Contactorcont = Contactor()def test_Profile_1():numd = urandom(32)[0]caddr = cont.privatekey_to_address(0, True, numd)uaddr = cont.privatekey_to_address(0, False, numd)"""# // Total Generatednum=10000time1=timeit.timeit("test_Profile_1()",setup=setup_code,number=num)print(f"Generated & Convereted{format(num,',')}Key To :{time1:.6f}sec")[!NOTE]
Output :Generated & Convereted 10,000 Key To : 0.393369 secUsageA quick example to get you started with SECP256k2:fromsecp256k2importContactorcont=Contactor()dec=0x00000000000000000000000000000000000000000000001wif_compress=cont.Decimal_To_Wif(dec,True)wif_uncompress=cont.Decimal_To_Wif(dec,False)compressed and uncompressed bitcoin address wallet from decimal (integer).fromsecp256k2importContactor# added Contactor class to project scriptco=Contactor()# decdec=0xffffffffffffffffffffff880000000000000compress_address=co.Decimal_To_Addr(dec,addr_type=0,compress=True)uncompress_address=co.Decimal_To_Addr(dec,addr_type=0,compress=False)Convert Decimal (Number) To Ethereum Address (Maximum Range:115792089237316195423570985008687907852837564279074904382605163141518161494337):fromsecp256k2importContactorcont=Contactor()dec_num=1# example , can use any range number to# ethereum address generated from decimal numbereth_address=cont.Decimal_To_ETH_Addr(dec_num)convert and Generated Wif Key from decimal Number:fromsecp256k2importContactorco=Contactor()dec=0xffffffffffffffffffffffffff8999999999333666666wif_compress=co.Decimal_To_Wif(dec,True)wif_uncompress=co.Decimal_To_Wif(dec,False)Decimal to RIPEMD160fromsecp256k2importContactorco=Contactor()dec=0xfffffffffffffffffff99999999999ripemd160=co.Decimal_To_RIPEMD160(dec)convert wif key to private key (hex):fromsecp256k2importContactorco=Contactor()WIF="WIF_KEY_HERE"privatekey=co.Wif_To_Hex(WIF)Convert Private Key To Wif Compressed and Uncompressedfromsecp256k2importContactorcont=Contactor()privatekey="PRIVATE_KEY_HERE"wif_compress=cont.btc_pvk_to_wif(privatekey,True)wif_uncompress=cont.btc_pvk_to_wif(privatekey,False)Convert Wif to Private Key (integer/decimal):fromsecp256k2importContactorcont=Contactor()wif="WIF_KEY_HERE"privatekey=cont.btc_wif_to_pvk_int(wif)Convert Wif to Private Key (hex):fromsecp256k2importContactorcont=Contactor()wif="WIF_KEY_HERE"privatekey=cont.btc_wif_to_pvk_hex(wif)Convert Private Key (decimal) To RIPEMD160 (h160)fromsecp256k2importContactorcont=Contactor()privatekey=12345678901234567891234567891234567789ripemd160=cont.privatekey_to_h160(privatekey)Convert Private Key (Decimal) To Compressed and uncompressed Addressaddr_type(int) : P2PKH =0, P2SH =1, P2WPKH =2compress(bool) :True: Compress,False: Uncompressprivate key(decimal) :0-115792089237316195423570985008687907852837564279074904382605163141518161494337fromsecp256k2importContactorcont=Contactor()privatekey=12345678901234567891234567891234567789address_compress=cont.privatekey_to_address(0,True,privatekey)address_uncompress=cont.privatekey_to_address(0,False,privatekey)DocumentationFor more detailed information and advanced usage, please refer to thefull documentation.ContributionWe welcome contributions from the open-source community. If you find any issues or would like to propose enhancements, please feel free to open an issue or submit a pull request.LicenseSECP256k2 is licensed under MIT. For more information, please see theLICENSEfile.Donate:Bitcoin:1MMDRZA12xdBLD1P5AfEfvEMErp588vmF9Programmer And Owner :PyMmdrzaEmail :Mmdrza@usa.comofficial website :MMDRZA.COM