libcrypto 1.1.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of libcrypto might be problematic. Click here for more details.
- libcrypto-1.1.4/LICENSE +21 -0
- libcrypto-1.1.4/PKG-INFO +225 -0
- libcrypto-1.1.4/README.md +174 -0
- libcrypto-1.1.4/pyproject.toml +73 -0
- libcrypto-1.1.4/setup.cfg +4 -0
- libcrypto-1.1.4/setup.py +87 -0
- libcrypto-1.1.4/src/libcrypto/__init__.py +72 -0
- libcrypto-1.1.4/src/libcrypto/_version.py +19 -0
- libcrypto-1.1.4/src/libcrypto/addresses.py +191 -0
- libcrypto-1.1.4/src/libcrypto/bip32.py +234 -0
- libcrypto-1.1.4/src/libcrypto/cli.py +159 -0
- libcrypto-1.1.4/src/libcrypto/constants.py +288 -0
- libcrypto-1.1.4/src/libcrypto/formats.py +164 -0
- libcrypto-1.1.4/src/libcrypto/hash.py +88 -0
- libcrypto-1.1.4/src/libcrypto/keys.py +149 -0
- libcrypto-1.1.4/src/libcrypto/mnemonic.py +156 -0
- libcrypto-1.1.4/src/libcrypto/secp256k1.py +117 -0
- libcrypto-1.1.4/src/libcrypto/wallet.py +135 -0
- libcrypto-1.1.4/src/libcrypto.egg-info/PKG-INFO +225 -0
- libcrypto-1.1.4/src/libcrypto.egg-info/SOURCES.txt +23 -0
- libcrypto-1.1.4/src/libcrypto.egg-info/dependency_links.txt +1 -0
- libcrypto-1.1.4/src/libcrypto.egg-info/entry_points.txt +2 -0
- libcrypto-1.1.4/src/libcrypto.egg-info/not-zip-safe +1 -0
- libcrypto-1.1.4/src/libcrypto.egg-info/requires.txt +16 -0
- libcrypto-1.1.4/src/libcrypto.egg-info/top_level.txt +1 -0
libcrypto-1.1.4/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 LibCrypto Team
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
libcrypto-1.1.4/PKG-INFO
ADDED
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: libcrypto
|
|
3
|
+
Version: 1.1.4
|
|
4
|
+
Summary: A professional library For Cryptography and Cryptocurrencies in Python.
|
|
5
|
+
Home-page: https://github.com/pymmdrza/libcrypto
|
|
6
|
+
Author: Mmdrza
|
|
7
|
+
Author-email: Mmdrza <pymmdrza@gmail.com>
|
|
8
|
+
License: MIT
|
|
9
|
+
Project-URL: Homepage, https://libcrypto.readthedocs.io/
|
|
10
|
+
Project-URL: Repository, https://github.com/Pymmdrza/libcrypto
|
|
11
|
+
Project-URL: Bug Tracker, https://github.com/Pymmdrza/libcrypto/issues
|
|
12
|
+
Project-URL: Documentation, https://libcrypto.readthedocs.io
|
|
13
|
+
Project-URL: PyPI, https://pypi.org/project/libcrypto/
|
|
14
|
+
Keywords: cryptocurrency,bitcoin,ethereum,wallet,bip39,bip32,bip44,mnemonic,private-key,public-key,address,hdwallet,crypto,blockchain,litecoin,dash,dogecoin,bitcoin-cash,secp256k1,pycryptodome,cryptography
|
|
15
|
+
Classifier: Development Status :: 4 - Beta
|
|
16
|
+
Classifier: Intended Audience :: Developers
|
|
17
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
18
|
+
Classifier: Operating System :: OS Independent
|
|
19
|
+
Classifier: Programming Language :: Python :: 3
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
25
|
+
Classifier: Topic :: Security :: Cryptography
|
|
26
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
27
|
+
Classifier: Topic :: Office/Business :: Financial
|
|
28
|
+
Classifier: Topic :: System :: Systems Administration :: Authentication/Directory
|
|
29
|
+
Classifier: Typing :: Typed
|
|
30
|
+
Requires-Python: >=3.8
|
|
31
|
+
Description-Content-Type: text/markdown
|
|
32
|
+
License-File: LICENSE
|
|
33
|
+
Requires-Dist: pycryptodome>=3.23.0
|
|
34
|
+
Requires-Dist: rich>=14.0.0
|
|
35
|
+
Requires-Dist: wheel>=0.45.1
|
|
36
|
+
Requires-Dist: setuptools>=80.9.0
|
|
37
|
+
Provides-Extra: dev
|
|
38
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
39
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
|
|
40
|
+
Requires-Dist: black>=22.0.0; extra == "dev"
|
|
41
|
+
Requires-Dist: flake8>=5.0.0; extra == "dev"
|
|
42
|
+
Requires-Dist: isort>=5.10.0; extra == "dev"
|
|
43
|
+
Requires-Dist: mypy>=1.0.0; extra == "dev"
|
|
44
|
+
Provides-Extra: test
|
|
45
|
+
Requires-Dist: pytest>=7.0.0; extra == "test"
|
|
46
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == "test"
|
|
47
|
+
Dynamic: author
|
|
48
|
+
Dynamic: home-page
|
|
49
|
+
Dynamic: license-file
|
|
50
|
+
Dynamic: requires-python
|
|
51
|
+
|
|
52
|
+
[](https://pypi.org/project/libcrypto/)
|
|
53
|
+
[](LICENSE)
|
|
54
|
+
|
|
55
|
+
# LibCrypto
|
|
56
|
+
|
|
57
|
+
A professional library for Cryptography and Cryptocurrencies in Python.
|
|
58
|
+
|
|
59
|
+
This library provides a comprehensive suite of tools for developers working with cryptocurrencies, focusing on key management and address generation with a clean, high-level API.
|
|
60
|
+
|
|
61
|
+
## Key Features
|
|
62
|
+
|
|
63
|
+
- **High-Level Wallet API**: A simple `Wallet` class to manage keys and addresses.
|
|
64
|
+
- **Multi-Currency Support**: Correctly generate addresses for numerous secp256k1-based cryptocurrencies, including:
|
|
65
|
+
- Bitcoin (BTC) - Legacy, SegWit (P2SH & Native)
|
|
66
|
+
- Ethereum (ETH)
|
|
67
|
+
- Tron (TRX)
|
|
68
|
+
- Ripple (XRP)
|
|
69
|
+
- Bitcoin Cash (BCH) - CashAddr format
|
|
70
|
+
- Litecoin (LTC)
|
|
71
|
+
- Dash (DASH)
|
|
72
|
+
- Dogecoin (DOGE)
|
|
73
|
+
- **Hierarchical Deterministic (HD) Wallets**: Full BIP32 support for generating wallets from a master seed.
|
|
74
|
+
- **BIP39 Mnemonic Support**: Generate, validate, and derive seeds from mnemonic phrases.
|
|
75
|
+
- **Key & Format Conversions**: Easily convert between WIF, Hex, and Bytes for private and public keys.
|
|
76
|
+
- **Powerful Command-Line Interface**: Perform common wallet operations directly from your terminal.
|
|
77
|
+
|
|
78
|
+
## Installation
|
|
79
|
+
|
|
80
|
+
Install the library using pip:
|
|
81
|
+
```bash
|
|
82
|
+
pip install libcrypto
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Quick Start (Library Usage)
|
|
86
|
+
|
|
87
|
+
```python
|
|
88
|
+
from libcrypto import Wallet
|
|
89
|
+
|
|
90
|
+
key = "Your private key here (hex)"
|
|
91
|
+
# Initialize the Wallet with the private key
|
|
92
|
+
# Replace "Your private key here (hex)" with your actual private key in hexadecimal format
|
|
93
|
+
wallet = Wallet(key)
|
|
94
|
+
# Generate P2PKH, P2SH-P2WPKH, P2WPKH addresses for Bitcoin
|
|
95
|
+
p2pkh = wallet.get_address(coin="bitcoin", address_type="p2pkh")
|
|
96
|
+
p2wsh = wallet.get_address(coin="bitcoin", address_type="p2sh-p2wpkh")
|
|
97
|
+
p2wpkh = wallet.get_address(coin="bitcoin", address_type="p2wpkh")
|
|
98
|
+
# Generate ethereum Address
|
|
99
|
+
ethereum_address = wallet.get_address(coin="ethereum")
|
|
100
|
+
# Generate Dash Address
|
|
101
|
+
dash = wallet.get_address(coin="dash")
|
|
102
|
+
# Generate Dogecoin Address
|
|
103
|
+
dogecoin_address = wallet.get_address(coin="dogecoin")
|
|
104
|
+
# Generate Tron Address
|
|
105
|
+
tron_address = wallet.get_address(coin="tron")
|
|
106
|
+
# Generate Ripple Address
|
|
107
|
+
ripple_address = wallet.get_address(coin="ripple")
|
|
108
|
+
# Generate Litecoin Address
|
|
109
|
+
litecoin_address = wallet.get_address(coin="litecoin")
|
|
110
|
+
# Generate Litecoin Address with specific address types
|
|
111
|
+
litecoin_address_p2pkh = wallet.get_address(coin="litecoin", address_type="p2pkh")
|
|
112
|
+
litecoin_address_p2wsh = wallet.get_address(coin="litecoin", address_type="p2sh-p2wpkh")
|
|
113
|
+
litecoin_address_p2wpkh = wallet.get_address(coin="litecoin", address_type="p2wpkh")
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
The library is designed to be straightforward. Here is a basic example of generating addresses from an existing private key.
|
|
117
|
+
|
|
118
|
+
```python
|
|
119
|
+
from libcrypto import Wallet
|
|
120
|
+
|
|
121
|
+
# Initialize a wallet from a WIF private key
|
|
122
|
+
wif_key = "L4ZQks37JHUadEqaj2nGB1eaZFcsRZwZGQ7WVYuQiztzg4pqopU6" # Example WIF key
|
|
123
|
+
wallet = Wallet(wif_key)
|
|
124
|
+
|
|
125
|
+
# Generate addresses for different coins
|
|
126
|
+
eth_address = wallet.get_address('ethereum')
|
|
127
|
+
btc_address = wallet.get_address('bitcoin', address_type='p2wpkh') # Native SegWit
|
|
128
|
+
bch_address = wallet.get_address('bitcoin_cash')
|
|
129
|
+
|
|
130
|
+
print(f"Ethereum Address: {eth_address}")
|
|
131
|
+
print(f"Bitcoin (SegWit) Address: {btc_address}")
|
|
132
|
+
print(f"Bitcoin Cash Address: {bch_address}")
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+

|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
## Quick Start (Command-Line Interface)
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
# version
|
|
142
|
+
libcrypto -v
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
Package Information:
|
|
146
|
+
```bash
|
|
147
|
+
libcrypto info
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### Wallet & Address Generation
|
|
151
|
+
- Generate a Wallet:
|
|
152
|
+
This is the main command for generating new wallets or deriving addresses from existing keys.
|
|
153
|
+
```bash
|
|
154
|
+
libcrypto generate [OPTIONS]
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
Options:
|
|
158
|
+
|
|
159
|
+
- `-p`, `--private-key` TEXT: Derive addresses from an existing private key (WIF or Hex format). If omitted, a new random wallet is generated.
|
|
160
|
+
- `-c`, `--coin` TEXT: Specify a coin to generate addresses for. This option can be used multiple times. Defaults to bitcoin and ethereum.
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
1. Generate a new wallet for Bitcoin and Litecoin:
|
|
164
|
+
```bash
|
|
165
|
+
libcrypto generate -c bitcoin -c litecoin
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
2. Generate a wallet from an existing private key:
|
|
169
|
+
```bash
|
|
170
|
+
libcrypto generate -p <your-private-key>
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
3. Derive addresses for a specific set of coins from a hex key:
|
|
174
|
+
```bash
|
|
175
|
+
libcrypto generate -p <your-hex-key> -c bitcoin -c ethereum -c dash -c tron
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### Mnemonic Management
|
|
179
|
+
|
|
180
|
+
The mnemonic subcommand is used for all BIP39 mnemonic phrase operations.
|
|
181
|
+
Generate a Mnemonic Phrase
|
|
182
|
+
|
|
183
|
+
Creates a new, cryptographically secure BIP39 mnemonic phrase.
|
|
184
|
+
|
|
185
|
+
```bash
|
|
186
|
+
libcrypto mnemonic generate [OPTIONS]
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
Options:
|
|
190
|
+
|
|
191
|
+
- `-w`, `--words` INTEGER: The number of words in the mnemonic. Can be 12, 15, 18, 21, or 24. [Default: 12]
|
|
192
|
+
|
|
193
|
+
Example:
|
|
194
|
+
```bash
|
|
195
|
+
libcrypto mnemonic generate --words 24
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
### Validate a Mnemonic Phrase
|
|
199
|
+
|
|
200
|
+
Checks if a given BIP39 mnemonic phrase is valid according to the checksum rules.
|
|
201
|
+
|
|
202
|
+
```bash
|
|
203
|
+
libcrypto mnemonic validate "PHRASE"
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
Arguments:
|
|
207
|
+
|
|
208
|
+
- `PHRASE`: The full mnemonic phrase, enclosed in double quotes. [Required]
|
|
209
|
+
|
|
210
|
+
Example:
|
|
211
|
+
```bash
|
|
212
|
+
libcrypto mnemonic validate "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about"
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
## Donate
|
|
216
|
+
|
|
217
|
+
If you find this library useful, consider supporting its development:
|
|
218
|
+
|
|
219
|
+
- **Bitcoin (BTC)**: `1MMDRZAcM6dzmdMUSV8pDdAPDFpwzve9Fc`
|
|
220
|
+
|
|
221
|
+
## Contact
|
|
222
|
+
|
|
223
|
+
For support or inquiries, please contact us at [pymmdrza@gmail.com](mailto:pymmdrza@gmail.com).
|
|
224
|
+
|
|
225
|
+
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
[](https://pypi.org/project/libcrypto/)
|
|
2
|
+
[](LICENSE)
|
|
3
|
+
|
|
4
|
+
# LibCrypto
|
|
5
|
+
|
|
6
|
+
A professional library for Cryptography and Cryptocurrencies in Python.
|
|
7
|
+
|
|
8
|
+
This library provides a comprehensive suite of tools for developers working with cryptocurrencies, focusing on key management and address generation with a clean, high-level API.
|
|
9
|
+
|
|
10
|
+
## Key Features
|
|
11
|
+
|
|
12
|
+
- **High-Level Wallet API**: A simple `Wallet` class to manage keys and addresses.
|
|
13
|
+
- **Multi-Currency Support**: Correctly generate addresses for numerous secp256k1-based cryptocurrencies, including:
|
|
14
|
+
- Bitcoin (BTC) - Legacy, SegWit (P2SH & Native)
|
|
15
|
+
- Ethereum (ETH)
|
|
16
|
+
- Tron (TRX)
|
|
17
|
+
- Ripple (XRP)
|
|
18
|
+
- Bitcoin Cash (BCH) - CashAddr format
|
|
19
|
+
- Litecoin (LTC)
|
|
20
|
+
- Dash (DASH)
|
|
21
|
+
- Dogecoin (DOGE)
|
|
22
|
+
- **Hierarchical Deterministic (HD) Wallets**: Full BIP32 support for generating wallets from a master seed.
|
|
23
|
+
- **BIP39 Mnemonic Support**: Generate, validate, and derive seeds from mnemonic phrases.
|
|
24
|
+
- **Key & Format Conversions**: Easily convert between WIF, Hex, and Bytes for private and public keys.
|
|
25
|
+
- **Powerful Command-Line Interface**: Perform common wallet operations directly from your terminal.
|
|
26
|
+
|
|
27
|
+
## Installation
|
|
28
|
+
|
|
29
|
+
Install the library using pip:
|
|
30
|
+
```bash
|
|
31
|
+
pip install libcrypto
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Quick Start (Library Usage)
|
|
35
|
+
|
|
36
|
+
```python
|
|
37
|
+
from libcrypto import Wallet
|
|
38
|
+
|
|
39
|
+
key = "Your private key here (hex)"
|
|
40
|
+
# Initialize the Wallet with the private key
|
|
41
|
+
# Replace "Your private key here (hex)" with your actual private key in hexadecimal format
|
|
42
|
+
wallet = Wallet(key)
|
|
43
|
+
# Generate P2PKH, P2SH-P2WPKH, P2WPKH addresses for Bitcoin
|
|
44
|
+
p2pkh = wallet.get_address(coin="bitcoin", address_type="p2pkh")
|
|
45
|
+
p2wsh = wallet.get_address(coin="bitcoin", address_type="p2sh-p2wpkh")
|
|
46
|
+
p2wpkh = wallet.get_address(coin="bitcoin", address_type="p2wpkh")
|
|
47
|
+
# Generate ethereum Address
|
|
48
|
+
ethereum_address = wallet.get_address(coin="ethereum")
|
|
49
|
+
# Generate Dash Address
|
|
50
|
+
dash = wallet.get_address(coin="dash")
|
|
51
|
+
# Generate Dogecoin Address
|
|
52
|
+
dogecoin_address = wallet.get_address(coin="dogecoin")
|
|
53
|
+
# Generate Tron Address
|
|
54
|
+
tron_address = wallet.get_address(coin="tron")
|
|
55
|
+
# Generate Ripple Address
|
|
56
|
+
ripple_address = wallet.get_address(coin="ripple")
|
|
57
|
+
# Generate Litecoin Address
|
|
58
|
+
litecoin_address = wallet.get_address(coin="litecoin")
|
|
59
|
+
# Generate Litecoin Address with specific address types
|
|
60
|
+
litecoin_address_p2pkh = wallet.get_address(coin="litecoin", address_type="p2pkh")
|
|
61
|
+
litecoin_address_p2wsh = wallet.get_address(coin="litecoin", address_type="p2sh-p2wpkh")
|
|
62
|
+
litecoin_address_p2wpkh = wallet.get_address(coin="litecoin", address_type="p2wpkh")
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
The library is designed to be straightforward. Here is a basic example of generating addresses from an existing private key.
|
|
66
|
+
|
|
67
|
+
```python
|
|
68
|
+
from libcrypto import Wallet
|
|
69
|
+
|
|
70
|
+
# Initialize a wallet from a WIF private key
|
|
71
|
+
wif_key = "L4ZQks37JHUadEqaj2nGB1eaZFcsRZwZGQ7WVYuQiztzg4pqopU6" # Example WIF key
|
|
72
|
+
wallet = Wallet(wif_key)
|
|
73
|
+
|
|
74
|
+
# Generate addresses for different coins
|
|
75
|
+
eth_address = wallet.get_address('ethereum')
|
|
76
|
+
btc_address = wallet.get_address('bitcoin', address_type='p2wpkh') # Native SegWit
|
|
77
|
+
bch_address = wallet.get_address('bitcoin_cash')
|
|
78
|
+
|
|
79
|
+
print(f"Ethereum Address: {eth_address}")
|
|
80
|
+
print(f"Bitcoin (SegWit) Address: {btc_address}")
|
|
81
|
+
print(f"Bitcoin Cash Address: {bch_address}")
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+

|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
## Quick Start (Command-Line Interface)
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
# version
|
|
91
|
+
libcrypto -v
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Package Information:
|
|
95
|
+
```bash
|
|
96
|
+
libcrypto info
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### Wallet & Address Generation
|
|
100
|
+
- Generate a Wallet:
|
|
101
|
+
This is the main command for generating new wallets or deriving addresses from existing keys.
|
|
102
|
+
```bash
|
|
103
|
+
libcrypto generate [OPTIONS]
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Options:
|
|
107
|
+
|
|
108
|
+
- `-p`, `--private-key` TEXT: Derive addresses from an existing private key (WIF or Hex format). If omitted, a new random wallet is generated.
|
|
109
|
+
- `-c`, `--coin` TEXT: Specify a coin to generate addresses for. This option can be used multiple times. Defaults to bitcoin and ethereum.
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
1. Generate a new wallet for Bitcoin and Litecoin:
|
|
113
|
+
```bash
|
|
114
|
+
libcrypto generate -c bitcoin -c litecoin
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
2. Generate a wallet from an existing private key:
|
|
118
|
+
```bash
|
|
119
|
+
libcrypto generate -p <your-private-key>
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
3. Derive addresses for a specific set of coins from a hex key:
|
|
123
|
+
```bash
|
|
124
|
+
libcrypto generate -p <your-hex-key> -c bitcoin -c ethereum -c dash -c tron
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### Mnemonic Management
|
|
128
|
+
|
|
129
|
+
The mnemonic subcommand is used for all BIP39 mnemonic phrase operations.
|
|
130
|
+
Generate a Mnemonic Phrase
|
|
131
|
+
|
|
132
|
+
Creates a new, cryptographically secure BIP39 mnemonic phrase.
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
libcrypto mnemonic generate [OPTIONS]
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
Options:
|
|
139
|
+
|
|
140
|
+
- `-w`, `--words` INTEGER: The number of words in the mnemonic. Can be 12, 15, 18, 21, or 24. [Default: 12]
|
|
141
|
+
|
|
142
|
+
Example:
|
|
143
|
+
```bash
|
|
144
|
+
libcrypto mnemonic generate --words 24
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### Validate a Mnemonic Phrase
|
|
148
|
+
|
|
149
|
+
Checks if a given BIP39 mnemonic phrase is valid according to the checksum rules.
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
libcrypto mnemonic validate "PHRASE"
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
Arguments:
|
|
156
|
+
|
|
157
|
+
- `PHRASE`: The full mnemonic phrase, enclosed in double quotes. [Required]
|
|
158
|
+
|
|
159
|
+
Example:
|
|
160
|
+
```bash
|
|
161
|
+
libcrypto mnemonic validate "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about"
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
## Donate
|
|
165
|
+
|
|
166
|
+
If you find this library useful, consider supporting its development:
|
|
167
|
+
|
|
168
|
+
- **Bitcoin (BTC)**: `1MMDRZAcM6dzmdMUSV8pDdAPDFpwzve9Fc`
|
|
169
|
+
|
|
170
|
+
## Contact
|
|
171
|
+
|
|
172
|
+
For support or inquiries, please contact us at [pymmdrza@gmail.com](mailto:pymmdrza@gmail.com).
|
|
173
|
+
|
|
174
|
+
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "libcrypto"
|
|
7
|
+
version = "1.1.4"
|
|
8
|
+
description = "A professional library For Cryptography and Cryptocurrencies in Python."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.8"
|
|
11
|
+
license = { text = "MIT" }
|
|
12
|
+
authors = [
|
|
13
|
+
{ name = "Mmdrza", email = "pymmdrza@gmail.com" },
|
|
14
|
+
]
|
|
15
|
+
keywords = [
|
|
16
|
+
"cryptocurrency", "bitcoin", "ethereum", "wallet", "bip39", "bip32", "bip44",
|
|
17
|
+
"mnemonic", "private-key", "public-key", "address", "hdwallet", "crypto",
|
|
18
|
+
"blockchain", "litecoin", "dash", "dogecoin", "bitcoin-cash", "secp256k1",
|
|
19
|
+
"pycryptodome", "cryptography",
|
|
20
|
+
]
|
|
21
|
+
classifiers = [
|
|
22
|
+
"Development Status :: 4 - Beta",
|
|
23
|
+
"Intended Audience :: Developers",
|
|
24
|
+
"License :: OSI Approved :: MIT License",
|
|
25
|
+
"Operating System :: OS Independent",
|
|
26
|
+
"Programming Language :: Python :: 3",
|
|
27
|
+
"Programming Language :: Python :: 3.8",
|
|
28
|
+
"Programming Language :: Python :: 3.9",
|
|
29
|
+
"Programming Language :: Python :: 3.10",
|
|
30
|
+
"Programming Language :: Python :: 3.11",
|
|
31
|
+
"Programming Language :: Python :: 3.12",
|
|
32
|
+
"Topic :: Security :: Cryptography",
|
|
33
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
34
|
+
"Topic :: Office/Business :: Financial",
|
|
35
|
+
"Topic :: System :: Systems Administration :: Authentication/Directory",
|
|
36
|
+
"Typing :: Typed",
|
|
37
|
+
]
|
|
38
|
+
dependencies = [
|
|
39
|
+
"pycryptodome>=3.23.0",
|
|
40
|
+
"rich>=14.0.0",
|
|
41
|
+
"wheel>=0.45.1",
|
|
42
|
+
"setuptools>=80.9.0",
|
|
43
|
+
]
|
|
44
|
+
|
|
45
|
+
[project.optional-dependencies]
|
|
46
|
+
dev = [
|
|
47
|
+
"pytest>=7.0.0",
|
|
48
|
+
"pytest-cov>=4.0.0",
|
|
49
|
+
"black>=22.0.0",
|
|
50
|
+
"flake8>=5.0.0",
|
|
51
|
+
"isort>=5.10.0",
|
|
52
|
+
"mypy>=1.0.0",
|
|
53
|
+
]
|
|
54
|
+
test = [
|
|
55
|
+
"pytest>=7.0.0",
|
|
56
|
+
"pytest-cov>=4.0.0",
|
|
57
|
+
]
|
|
58
|
+
|
|
59
|
+
[project.urls]
|
|
60
|
+
Homepage = "https://libcrypto.readthedocs.io/"
|
|
61
|
+
Repository = "https://github.com/Pymmdrza/libcrypto"
|
|
62
|
+
"Bug Tracker" = "https://github.com/Pymmdrza/libcrypto/issues"
|
|
63
|
+
Documentation = "https://libcrypto.readthedocs.io"
|
|
64
|
+
PyPI = "https://pypi.org/project/libcrypto/"
|
|
65
|
+
|
|
66
|
+
[project.scripts]
|
|
67
|
+
libcrypto = "libcrypto.cli:app"
|
|
68
|
+
|
|
69
|
+
[tool.setuptools]
|
|
70
|
+
package-dir = { "" = "src" }
|
|
71
|
+
|
|
72
|
+
[tool.setuptools.packages.find]
|
|
73
|
+
where = ["src"]
|
libcrypto-1.1.4/setup.py
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Setup script for libcrypto package.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from setuptools import setup, find_packages
|
|
6
|
+
import os
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def get_long_description():
|
|
10
|
+
"""Get the long description from README.md."""
|
|
11
|
+
readme_path = os.path.join(os.path.dirname(__file__), "README.md")
|
|
12
|
+
if os.path.exists(readme_path):
|
|
13
|
+
with open(readme_path, encoding="utf-8") as f:
|
|
14
|
+
return f.read()
|
|
15
|
+
return ""
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
setup(
|
|
19
|
+
name="libcrypto",
|
|
20
|
+
version="1.1.4",
|
|
21
|
+
description="Comprehensive cryptocurrency wallet library with BIP39/BIP32 support using only pycryptodome",
|
|
22
|
+
long_description=get_long_description(),
|
|
23
|
+
long_description_content_type="text/markdown",
|
|
24
|
+
author="Mmdrza",
|
|
25
|
+
author_email="pymmdrza@gmail.com",
|
|
26
|
+
url="https://github.com/pymmdrza/libcrypto",
|
|
27
|
+
project_urls={
|
|
28
|
+
"Homepage": "https://github.com/pymmdrza/libcrypto",
|
|
29
|
+
"Documentation": "https://libcrypto.readthedocs.io",
|
|
30
|
+
"Repository": "https://github.com/pymmdrza/libcrypto.git",
|
|
31
|
+
"Issues": "https://github.com/pymmdrza/libcrypto/issues",
|
|
32
|
+
"PyPI": "https://pypi.org/project/libcrypto/",
|
|
33
|
+
},
|
|
34
|
+
license="MIT",
|
|
35
|
+
packages=find_packages(where="src"),
|
|
36
|
+
package_dir={"": "src"},
|
|
37
|
+
python_requires=">=3.8",
|
|
38
|
+
install_requires=[
|
|
39
|
+
"pycryptodome>=3.23.0",
|
|
40
|
+
"rich>=14.0.0",
|
|
41
|
+
"wheel>=0.45.1",
|
|
42
|
+
"setuptools>=80.9.0",
|
|
43
|
+
],
|
|
44
|
+
extras_require={
|
|
45
|
+
"dev": [
|
|
46
|
+
"pytest>=7.0.0",
|
|
47
|
+
"pytest-cov>=4.0.0",
|
|
48
|
+
"black>=22.0.0",
|
|
49
|
+
"flake8>=5.0.0",
|
|
50
|
+
"isort>=5.10.0",
|
|
51
|
+
"mypy>=1.0.0",
|
|
52
|
+
],
|
|
53
|
+
"test": [
|
|
54
|
+
"pytest>=7.0.0",
|
|
55
|
+
"pytest-cov>=4.0.0",
|
|
56
|
+
],
|
|
57
|
+
},
|
|
58
|
+
classifiers=[
|
|
59
|
+
"Development Status :: 4 - Beta",
|
|
60
|
+
"Intended Audience :: Developers",
|
|
61
|
+
"License :: OSI Approved :: MIT License",
|
|
62
|
+
"Operating System :: OS Independent",
|
|
63
|
+
"Programming Language :: Python :: 3",
|
|
64
|
+
"Programming Language :: Python :: 3.8",
|
|
65
|
+
"Programming Language :: Python :: 3.9",
|
|
66
|
+
"Programming Language :: Python :: 3.10",
|
|
67
|
+
"Programming Language :: Python :: 3.11",
|
|
68
|
+
"Programming Language :: Python :: 3.12",
|
|
69
|
+
"Topic :: Security :: Cryptography",
|
|
70
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
71
|
+
"Topic :: Office/Business :: Financial",
|
|
72
|
+
"Topic :: System :: Systems Administration :: Authentication/Directory",
|
|
73
|
+
"Typing :: Typed",
|
|
74
|
+
],
|
|
75
|
+
keywords=[
|
|
76
|
+
"cryptocurrency", "bitcoin", "ethereum", "wallet", "bip39", "bip32", "bip44",
|
|
77
|
+
"mnemonic", "private-key", "public-key", "address", "hdwallet", "crypto",
|
|
78
|
+
"blockchain", "litecoin", "dash", "dogecoin", "bitcoin-cash", "secp256k1",
|
|
79
|
+
"pycryptodome", "cryptography",
|
|
80
|
+
],
|
|
81
|
+
zip_safe=False,
|
|
82
|
+
entry_points={
|
|
83
|
+
"console_scripts": [
|
|
84
|
+
# Add any command-line tools here if needed
|
|
85
|
+
],
|
|
86
|
+
},
|
|
87
|
+
)
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"""
|
|
2
|
+
LibCrypto Wallet Module
|
|
3
|
+
|
|
4
|
+
This module provides comprehensive cryptocurrency wallet functionality including:
|
|
5
|
+
- BIP32 Hierarchical Deterministic (HD) wallets
|
|
6
|
+
- Multi-currency address generation
|
|
7
|
+
- Key format conversions
|
|
8
|
+
- WIF (Wallet Import Format) support
|
|
9
|
+
"""
|
|
10
|
+
from .wallet import Wallet
|
|
11
|
+
from .bip32 import HDWallet, HDNode, BIP32Error
|
|
12
|
+
from .keys import PrivateKey, PublicKey, KeyError
|
|
13
|
+
from .mnemonic import (
|
|
14
|
+
generate_mnemonic,
|
|
15
|
+
validate_mnemonic,
|
|
16
|
+
mnemonic_to_seed,
|
|
17
|
+
mnemonic_to_entropy,
|
|
18
|
+
entropy_to_mnemonic,
|
|
19
|
+
InvalidMnemonicError,
|
|
20
|
+
InvalidEntropyError
|
|
21
|
+
)
|
|
22
|
+
from .addresses import AddressGenerator, AddressError
|
|
23
|
+
from .formats import (
|
|
24
|
+
private_key_to_wif,
|
|
25
|
+
wif_to_private_key,
|
|
26
|
+
base58_encode,
|
|
27
|
+
base58_decode,
|
|
28
|
+
bytes_to_hex,
|
|
29
|
+
hex_to_bytes,
|
|
30
|
+
InvalidFormatError
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
__version__ = "1.1.4"
|
|
34
|
+
__all__ = [
|
|
35
|
+
# Library Version
|
|
36
|
+
'__version__',
|
|
37
|
+
|
|
38
|
+
# High-Level Wallet
|
|
39
|
+
'Wallet',
|
|
40
|
+
|
|
41
|
+
# HD Wallet
|
|
42
|
+
'HDWallet',
|
|
43
|
+
'HDNode',
|
|
44
|
+
'BIP32Error',
|
|
45
|
+
|
|
46
|
+
# Key classes
|
|
47
|
+
'PrivateKey',
|
|
48
|
+
'PublicKey',
|
|
49
|
+
'KeyError',
|
|
50
|
+
|
|
51
|
+
# Address generation
|
|
52
|
+
'AddressGenerator',
|
|
53
|
+
'AddressError',
|
|
54
|
+
|
|
55
|
+
# Format conversions
|
|
56
|
+
'private_key_to_wif',
|
|
57
|
+
'wif_to_private_key',
|
|
58
|
+
'base58_encode',
|
|
59
|
+
'base58_decode',
|
|
60
|
+
'bytes_to_hex',
|
|
61
|
+
'hex_to_bytes',
|
|
62
|
+
'InvalidFormatError',
|
|
63
|
+
|
|
64
|
+
# Mnemonic functions
|
|
65
|
+
'generate_mnemonic',
|
|
66
|
+
'validate_mnemonic',
|
|
67
|
+
'mnemonic_to_seed',
|
|
68
|
+
'mnemonic_to_entropy',
|
|
69
|
+
'entropy_to_mnemonic',
|
|
70
|
+
'InvalidMnemonicError',
|
|
71
|
+
'InvalidEntropyError'
|
|
72
|
+
]
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Version information for LibCrypto package.
|
|
3
|
+
This is the single source of truth for version numbers, managed by bump-my-version.
|
|
4
|
+
|
|
5
|
+
Requires Python 3.8+
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
__author__ = "Mmdrza"
|
|
9
|
+
__author_email__ = "pymmdrza@gmail.com"
|
|
10
|
+
__description__ = (
|
|
11
|
+
"A professional library For Cryptography and Cryptocurrencies in Python."
|
|
12
|
+
)
|
|
13
|
+
__url__ = "https://github.com/Pymmdrza/libcrypto"
|
|
14
|
+
# version Libcrypto
|
|
15
|
+
__version__ = "1.0.0"
|
|
16
|
+
|
|
17
|
+
# Additional metadata
|
|
18
|
+
__license__ = "MIT"
|
|
19
|
+
__copyright__ = "2025 Mmdrza"
|