Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -6,6 +6,10 @@ from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC
|
|
| 6 |
from Crypto.Hash import SHA256
|
| 7 |
from Crypto.PublicKey import RSA
|
| 8 |
from Crypto.Signature import pkcs1_15
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
import os
|
| 11 |
import base64
|
|
@@ -18,6 +22,26 @@ import json
|
|
| 18 |
|
| 19 |
eth_wal = gr.Interface.load("spaces/Omnibus/decentral-test-mod")
|
| 20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
def eth_create(seed = None):
|
| 22 |
priv,pub,addr,seed = eth_wal(seed)
|
| 23 |
qr_wal=qrx.make(addr)
|
|
|
|
| 6 |
from Crypto.Hash import SHA256
|
| 7 |
from Crypto.PublicKey import RSA
|
| 8 |
from Crypto.Signature import pkcs1_15
|
| 9 |
+
import binascii
|
| 10 |
+
|
| 11 |
+
from eth_account import Account
|
| 12 |
+
import secrets
|
| 13 |
|
| 14 |
import os
|
| 15 |
import base64
|
|
|
|
| 22 |
|
| 23 |
eth_wal = gr.Interface.load("spaces/Omnibus/decentral-test-mod")
|
| 24 |
|
| 25 |
+
def rsa_encrypt_eth():
|
| 26 |
+
|
| 27 |
+
priv = secrets.token_hex(32)
|
| 28 |
+
private_key = "0x" + priv
|
| 29 |
+
print ("SAVE BUT DO NOT SHARE THIS:", private_key)
|
| 30 |
+
acct = Account.from_key(private_key)
|
| 31 |
+
print("Address:", acct.address)
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
def rsa_encrypt():
|
| 35 |
+
private_key = RSA.generate(2048)
|
| 36 |
+
public_key = private_key.publickey().export_key()
|
| 37 |
+
hash_1 = calculate_hash(public_key, hash_function="sha256")
|
| 38 |
+
hash_2 = calculate_hash(hash_1, hash_function="ripemd160")
|
| 39 |
+
address = base58.b58encode(hash_2)
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
|
| 44 |
+
|
| 45 |
def eth_create(seed = None):
|
| 46 |
priv,pub,addr,seed = eth_wal(seed)
|
| 47 |
qr_wal=qrx.make(addr)
|