secp256k2


Namesecp256k2 JSON
Version 1.4.6 PyPI version JSON
download
home_pagehttps://github.com/secp256k2/secp256k2
SummaryGenerated and Converted Keys with any Type Foundation from Private Key [WIF Hexed Mnemonic and Binary Bytes seed] in Python
upload_time2024-02-03 19:11:09
maintainer
docs_urlNone
authorMohammadreza (Mmdrza.Com)
requires_python
licenseMIT
keywords secp256k2 secp256k1 wif mnemonic binary seed foundation private key hex mnemonic binary bytes bitcoin ethereum tron dogecoin zcash digibyte bitcoin gold wallet bip32 bip39 litecoin qtum ravencoin btc eth trx doge btg ltc zec axe dash
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # SECP256k2: A Modern Library for Elliptic Curve Cryptography

[![Google Colab](https://img.shields.io/badge/Google_Clab-Run_Now-50AF95?style=plastic)](https://colab.research.google.com/drive/1cYAahMj6n03I3yA5DnDVwbxhDbg9nuwA?usp=sharing) [![PyPI - Downloads](https://img.shields.io/pypi/dd/secp256k1?style=plastic&color=0075A8)](https://pypi.org/project/secp256k2/ 'PyPI - SECP256K2 - Download Per Day')  [![GitHub closed pull requests](https://img.shields.io/github/issues-pr-closed/secp256k2/secp256k2?style=plastic&color=CA4245)
](https://github.com/secp256k2/secp256k2/pulls) [![GitHub issues](https://img.shields.io/github/issues-raw/secp256k2/secp256k2?style=plastic&color=CA4245)](https://github.com/secp256k2/secp256k2/issues) [![PyPI - License](https://img.shields.io/pypi/l/secp256k2?color=50AF95)](https://github.com/secp256k2/secp256k2/blob/main/LICENSE)
 [![PyPI - Status](https://img.shields.io/pypi/status/SECP256K2?style=plastic&color=50AF95)
](https://pypi.org/project/secp256k2/) [![Read the Docs](https://img.shields.io/readthedocs/secp256k2?color=50AF95)
](https://secp256k2.readthedocs.io/en/latest/) [![programmer Official Website](https://img.shields.io/badge/Programmer_Website-Mmdrza.Com-0075A8?style=plastic)](https://mmdrza.com) [![](https://img.shields.io/badge/Donate_-Bitcoin_Wallet-F7931A?style=plastic&logo=bitcoin)](https://github.com/secp256k2/secp256k2#donate)


---
## Introduction

**SECP256k2** is 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.


## Features

- **Optimized 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 in `C` & `Python`, _SECP256k2_ is designed to be used on multiple operating systems including Windows and Linux & Mac.

## Getting Started

### Installation

#### windows with `pip`
```bash
pip install --upgrade secp256k2
```

#### linux and Mac with `pip3`
```bash
pip3 install --upgrade secp256k2
```

### Generate and Converet 10,000 Key to Compress and Uncompress Address. ( Check Now in [Google Colab](https://colab.research.google.com/drive/1cYAahMj6n03I3yA5DnDVwbxhDbg9nuwA#scrollTo=qtb00EBtyCUA) )

```python
import os, timeit

setup_code = """
from os import urandom
from secp256k2 import Contactor

cont = 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 Generated 
num = 10000

time1 = 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 sec`

### Usage

A quick example to get you started with SECP256k2:

```python
from secp256k2 import Contactor

cont = Contactor()

dec = 0x00000000000000000000000000000000000000000000001

wif_compress = cont.Decimal_To_Wif(dec, True)

wif_uncompress = cont.Decimal_To_Wif(dec, False)

```
---

compressed and uncompressed bitcoin address wallet from decimal (integer).

```python
from secp256k2 import Contactor
# added Contactor class to project script
co = Contactor()
# dec
dec = 0xffffffffffffffffffffff880000000000000
compress_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`):

```python
from secp256k2 import Contactor

cont = Contactor()

dec_num = 1 # example , can use any range number to 
# ethereum address generated from decimal number 
eth_address = cont.Decimal_To_ETH_Addr(dec_num)
```
---
convert and Generated Wif Key from decimal Number:
```python
from secp256k2 import Contactor

co = Contactor()

dec = 0xffffffffffffffffffffffffff8999999999333666666
wif_compress = co.Decimal_To_Wif(dec, True)
wif_uncompress = co.Decimal_To_Wif(dec, False)
```
---
Decimal to RIPEMD160

```python
from secp256k2 import Contactor

co = Contactor()

dec = 0xfffffffffffffffffff99999999999

ripemd160 = co.Decimal_To_RIPEMD160(dec)
```
---
convert wif key to private key (hex):

```python
from secp256k2 import Contactor

co = Contactor()

WIF = "WIF_KEY_HERE"

privatekey = co.Wif_To_Hex(WIF)
```

### Convert Private Key To Wif Compressed and Uncompressed

```python
from secp256k2 import Contactor

cont = 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):

```python
from secp256k2 import Contactor

cont = Contactor()

wif = "WIF_KEY_HERE"

privatekey = cont.btc_wif_to_pvk_int(wif)
```

### Convert Wif to Private Key (hex):

```python

from secp256k2 import Contactor

cont = Contactor()

wif = "WIF_KEY_HERE"

privatekey = cont.btc_wif_to_pvk_hex(wif)
```

### Convert Private Key (decimal) To RIPEMD160 (h160)

```python

from secp256k2 import Contactor

cont = Contactor()

privatekey = 12345678901234567891234567891234567789

ripemd160 = cont.privatekey_to_h160(privatekey)

```

### Convert Private Key (Decimal) To Compressed and uncompressed Address

- **addr_type** (_int_) : P2PKH = `0`, P2SH = `1`, P2WPKH = `2`
- **compress** (_bool_) : `True` : Compress, `False` : Uncompress
- **private key** (_decimal_) : `0` - `115792089237316195423570985008687907852837564279074904382605163141518161494337`

```python

from secp256k2 import Contactor

cont = Contactor()

privatekey = 12345678901234567891234567891234567789

address_compress = cont.privatekey_to_address(0, True, privatekey)

address_uncompress = cont.privatekey_to_address(0, False, privatekey)
```
## Documentation

For more detailed information and advanced usage, please refer to the [full documentation](https://secp256k2.github.io/secp256k2).

## Contribution

We 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.

## License

SECP256k2 is licensed under MIT. For more information, please see the [LICENSE](/LICENSE) file.

---

### Donate:

Bitcoin:`1MMDRZA12xdBLD1P5AfEfvEMErp588vmF9`


Programmer And Owner : [PyMmdrza](https://github.com/Pymmdrza)

Email : Mmdrza@usa.com

official website : <a title="official website programmer" href="https://mmdrza.com/" rel="follow">MMDRZA.COM</a>

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/secp256k2/secp256k2",
    "name": "secp256k2",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "secp256k2,secp256k1,Wif,Mnemonic,Binary,seed,Foundation,Private,Key,HEX,Mnemonic,Binary,Bytes,bitcoin,ethereum,tron,dogecoin,zcash,digibyte,bitcoin gold,wallet,bip32,bip39,litecoin,qtum,ravencoin,BTC,ETH,TRX,DOGE,BTG,LTC,ZEC,AXE,DASH",
    "author": "Mohammadreza (Mmdrza.Com)",
    "author_email": "Pymmdrza@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/4c/4c/3d538c11cf57b1f4ae692823d67cd484de73c24072268aaff3d0fd865eea/secp256k2-1.4.6.tar.gz",
    "platform": null,
    "description": "# SECP256k2: A Modern Library for Elliptic Curve Cryptography\n\n[![Google Colab](https://img.shields.io/badge/Google_Clab-Run_Now-50AF95?style=plastic)](https://colab.research.google.com/drive/1cYAahMj6n03I3yA5DnDVwbxhDbg9nuwA?usp=sharing) [![PyPI - Downloads](https://img.shields.io/pypi/dd/secp256k1?style=plastic&color=0075A8)](https://pypi.org/project/secp256k2/ 'PyPI - SECP256K2 - Download Per Day')  [![GitHub closed pull requests](https://img.shields.io/github/issues-pr-closed/secp256k2/secp256k2?style=plastic&color=CA4245)\n](https://github.com/secp256k2/secp256k2/pulls) [![GitHub issues](https://img.shields.io/github/issues-raw/secp256k2/secp256k2?style=plastic&color=CA4245)](https://github.com/secp256k2/secp256k2/issues) [![PyPI - License](https://img.shields.io/pypi/l/secp256k2?color=50AF95)](https://github.com/secp256k2/secp256k2/blob/main/LICENSE)\n [![PyPI - Status](https://img.shields.io/pypi/status/SECP256K2?style=plastic&color=50AF95)\n](https://pypi.org/project/secp256k2/) [![Read the Docs](https://img.shields.io/readthedocs/secp256k2?color=50AF95)\n](https://secp256k2.readthedocs.io/en/latest/) [![programmer Official Website](https://img.shields.io/badge/Programmer_Website-Mmdrza.Com-0075A8?style=plastic)](https://mmdrza.com) [![](https://img.shields.io/badge/Donate_-Bitcoin_Wallet-F7931A?style=plastic&logo=bitcoin)](https://github.com/secp256k2/secp256k2#donate)\n\n\n---\n## Introduction\n\n**SECP256k2** is 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.\n\n\n## Features\n\n- **Optimized Performance:** Leveraging optimized algorithms and efficient code structures for high-speed operations on the SECP256k1 curve.\n- **Comprehensive Toolset:** Offering a wide array of functionalities ranging from basic arithmetic operations to advanced cryptographic protocols.\n- **Cross-Platform:** Written in `C` & `Python`, _SECP256k2_ is designed to be used on multiple operating systems including Windows and Linux & Mac.\n\n## Getting Started\n\n### Installation\n\n#### windows with `pip`\n```bash\npip install --upgrade secp256k2\n```\n\n#### linux and Mac with `pip3`\n```bash\npip3 install --upgrade secp256k2\n```\n\n### Generate and Converet 10,000 Key to Compress and Uncompress Address. ( Check Now in [Google Colab](https://colab.research.google.com/drive/1cYAahMj6n03I3yA5DnDVwbxhDbg9nuwA#scrollTo=qtb00EBtyCUA) )\n\n```python\nimport os, timeit\n\nsetup_code = \"\"\"\nfrom os import urandom\nfrom secp256k2 import Contactor\n\ncont = Contactor()\n\ndef test_Profile_1():\n    numd = urandom(32)[0]\n    caddr = cont.privatekey_to_address(0, True, numd)\n    uaddr = cont.privatekey_to_address(0, False, numd)\n\"\"\"\n\n# // Total Generated \nnum = 10000\n\ntime1 = timeit.timeit(\"test_Profile_1()\", setup=setup_code, number=num)\n\n\nprint(f\"Generated & Convereted {format(num, ',')} Key To : {time1:.6f} sec\")\n```\n>[!NOTE]\n> Output : `Generated & Convereted 10,000 Key To : 0.393369 sec`\n\n### Usage\n\nA quick example to get you started with SECP256k2:\n\n```python\nfrom secp256k2 import Contactor\n\ncont = Contactor()\n\ndec = 0x00000000000000000000000000000000000000000000001\n\nwif_compress = cont.Decimal_To_Wif(dec, True)\n\nwif_uncompress = cont.Decimal_To_Wif(dec, False)\n\n```\n---\n\ncompressed and uncompressed bitcoin address wallet from decimal (integer).\n\n```python\nfrom secp256k2 import Contactor\n# added Contactor class to project script\nco = Contactor()\n# dec\ndec = 0xffffffffffffffffffffff880000000000000\ncompress_address = co.Decimal_To_Addr(dec, addr_type=0, compress=True)\nuncompress_address = co.Decimal_To_Addr(dec, addr_type=0, compress=False)\n```\n---\n\nConvert Decimal (Number) To Ethereum Address (Maximum Range: `115792089237316195423570985008687907852837564279074904382605163141518161494337`):\n\n```python\nfrom secp256k2 import Contactor\n\ncont = Contactor()\n\ndec_num = 1 # example , can use any range number to \n# ethereum address generated from decimal number \neth_address = cont.Decimal_To_ETH_Addr(dec_num)\n```\n---\nconvert and Generated Wif Key from decimal Number:\n```python\nfrom secp256k2 import Contactor\n\nco = Contactor()\n\ndec = 0xffffffffffffffffffffffffff8999999999333666666\nwif_compress = co.Decimal_To_Wif(dec, True)\nwif_uncompress = co.Decimal_To_Wif(dec, False)\n```\n---\nDecimal to RIPEMD160\n\n```python\nfrom secp256k2 import Contactor\n\nco = Contactor()\n\ndec = 0xfffffffffffffffffff99999999999\n\nripemd160 = co.Decimal_To_RIPEMD160(dec)\n```\n---\nconvert wif key to private key (hex):\n\n```python\nfrom secp256k2 import Contactor\n\nco = Contactor()\n\nWIF = \"WIF_KEY_HERE\"\n\nprivatekey = co.Wif_To_Hex(WIF)\n```\n\n### Convert Private Key To Wif Compressed and Uncompressed\n\n```python\nfrom secp256k2 import Contactor\n\ncont = Contactor()\n\nprivatekey = \"PRIVATE_KEY_HERE\"\n\nwif_compress = cont.btc_pvk_to_wif(privatekey, True)\n\nwif_uncompress = cont.btc_pvk_to_wif(privatekey, False)\n\n```\n\n### Convert Wif to Private Key (integer/decimal):\n\n```python\nfrom secp256k2 import Contactor\n\ncont = Contactor()\n\nwif = \"WIF_KEY_HERE\"\n\nprivatekey = cont.btc_wif_to_pvk_int(wif)\n```\n\n### Convert Wif to Private Key (hex):\n\n```python\n\nfrom secp256k2 import Contactor\n\ncont = Contactor()\n\nwif = \"WIF_KEY_HERE\"\n\nprivatekey = cont.btc_wif_to_pvk_hex(wif)\n```\n\n### Convert Private Key (decimal) To RIPEMD160 (h160)\n\n```python\n\nfrom secp256k2 import Contactor\n\ncont = Contactor()\n\nprivatekey = 12345678901234567891234567891234567789\n\nripemd160 = cont.privatekey_to_h160(privatekey)\n\n```\n\n### Convert Private Key (Decimal) To Compressed and uncompressed Address\n\n- **addr_type** (_int_) : P2PKH = `0`, P2SH = `1`, P2WPKH = `2`\n- **compress** (_bool_) : `True` : Compress, `False` : Uncompress\n- **private key** (_decimal_) : `0` - `115792089237316195423570985008687907852837564279074904382605163141518161494337`\n\n```python\n\nfrom secp256k2 import Contactor\n\ncont = Contactor()\n\nprivatekey = 12345678901234567891234567891234567789\n\naddress_compress = cont.privatekey_to_address(0, True, privatekey)\n\naddress_uncompress = cont.privatekey_to_address(0, False, privatekey)\n```\n## Documentation\n\nFor more detailed information and advanced usage, please refer to the [full documentation](https://secp256k2.github.io/secp256k2).\n\n## Contribution\n\nWe 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.\n\n## License\n\nSECP256k2 is licensed under MIT. For more information, please see the [LICENSE](/LICENSE) file.\n\n---\n\n### Donate:\n\nBitcoin:`1MMDRZA12xdBLD1P5AfEfvEMErp588vmF9`\n\n\nProgrammer And Owner : [PyMmdrza](https://github.com/Pymmdrza)\n\nEmail : Mmdrza@usa.com\n\nofficial website : <a title=\"official website programmer\" href=\"https://mmdrza.com/\" rel=\"follow\">MMDRZA.COM</a>\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Generated and Converted Keys with any Type Foundation from Private Key [WIF Hexed Mnemonic and Binary Bytes seed] in Python",
    "version": "1.4.6",
    "project_urls": {
        "Bug Tracker": "https://github.com/secp256k2/secp256k2/issues",
        "Documentation": "https://github.com/secp256k2/secp256k2",
        "Homepage": "https://github.com/secp256k2/secp256k2",
        "Source Code": "https://github.com/secp256k2/secp256k2",
        "Website": "https://mmdrza.com"
    },
    "split_keywords": [
        "secp256k2",
        "secp256k1",
        "wif",
        "mnemonic",
        "binary",
        "seed",
        "foundation",
        "private",
        "key",
        "hex",
        "mnemonic",
        "binary",
        "bytes",
        "bitcoin",
        "ethereum",
        "tron",
        "dogecoin",
        "zcash",
        "digibyte",
        "bitcoin gold",
        "wallet",
        "bip32",
        "bip39",
        "litecoin",
        "qtum",
        "ravencoin",
        "btc",
        "eth",
        "trx",
        "doge",
        "btg",
        "ltc",
        "zec",
        "axe",
        "dash"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b1851e8c2ec27d4f382a63353182d0be3439434aa7775f932a9c929fd3949d40",
                "md5": "c7e26652e6bec7faab769cd4e924dcdd",
                "sha256": "00c26e5a6187746c9a84bbfc87c9f870f903555d27beacbd39fa881f8737003c"
            },
            "downloads": -1,
            "filename": "secp256k2-1.4.6-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c7e26652e6bec7faab769cd4e924dcdd",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 6220287,
            "upload_time": "2024-02-03T19:11:02",
            "upload_time_iso_8601": "2024-02-03T19:11:02.330829Z",
            "url": "https://files.pythonhosted.org/packages/b1/85/1e8c2ec27d4f382a63353182d0be3439434aa7775f932a9c929fd3949d40/secp256k2-1.4.6-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4c4c3d538c11cf57b1f4ae692823d67cd484de73c24072268aaff3d0fd865eea",
                "md5": "824d35b43c678240aea632456861dbc1",
                "sha256": "4efd223615987534f170e57c38901d4b489509dfb39ecc653ceba51814408c78"
            },
            "downloads": -1,
            "filename": "secp256k2-1.4.6.tar.gz",
            "has_sig": false,
            "md5_digest": "824d35b43c678240aea632456861dbc1",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 5977544,
            "upload_time": "2024-02-03T19:11:09",
            "upload_time_iso_8601": "2024-02-03T19:11:09.207754Z",
            "url": "https://files.pythonhosted.org/packages/4c/4c/3d538c11cf57b1f4ae692823d67cd484de73c24072268aaff3d0fd865eea/secp256k2-1.4.6.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-03 19:11:09",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "secp256k2",
    "github_project": "secp256k2",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "secp256k2"
}
        
Elapsed time: 0.43936s