Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -4,6 +4,24 @@ import os
|
|
4 |
rec_list = []
|
5 |
pa=os.environ['PASS']
|
6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
def checkp(inp):
|
8 |
if inp == pa:
|
9 |
return gr.update(visible=False), gr.update(visible=True)
|
@@ -55,6 +73,8 @@ with gr.Blocks() as app:
|
|
55 |
rsa_dec_btn = gr.Button("RSA Decrypt")
|
56 |
rsa_dec_mes = gr.Textbox(label="decoded")
|
57 |
|
|
|
|
|
58 |
pass_btn.click(checkp,pass_box,[invalid,valida])
|
59 |
|
60 |
gen_wal_btn.click(crypt.generate_keys,None,[out2,out1,img3,out3,img1,img2]).then(crypt.test_fn,[img1,img3],[input_key,input_address])
|
|
|
4 |
rec_list = []
|
5 |
pa=os.environ['PASS']
|
6 |
|
7 |
+
def address(im):
|
8 |
+
|
9 |
+
secret_code="SECRET PASSWORD"
|
10 |
+
priv_key = crypt.decode(im)
|
11 |
+
print(f'priv_key:: {priv_key}')
|
12 |
+
key = RSA.import_key(priv_key,passphrase=secret_code)
|
13 |
+
|
14 |
+
public_key = key.publickey().export_key('PEM')
|
15 |
+
file_out_pub = open("receiver.pem", "wb")
|
16 |
+
file_out_pub.write(public_key)
|
17 |
+
file_out_pub.close()
|
18 |
+
|
19 |
+
|
20 |
+
hash_1 = calculate_hash(public_key, hash_function="sha256")
|
21 |
+
hash_2 = calculate_hash(hash_1, hash_function="ripemd160")
|
22 |
+
address = base58.b58encode(hash_2)
|
23 |
+
print (address)
|
24 |
+
|
25 |
def checkp(inp):
|
26 |
if inp == pa:
|
27 |
return gr.update(visible=False), gr.update(visible=True)
|
|
|
73 |
rsa_dec_btn = gr.Button("RSA Decrypt")
|
74 |
rsa_dec_mes = gr.Textbox(label="decoded")
|
75 |
|
76 |
+
input_key.change(address,input_key,None)
|
77 |
+
|
78 |
pass_btn.click(checkp,pass_box,[invalid,valida])
|
79 |
|
80 |
gen_wal_btn.click(crypt.generate_keys,None,[out2,out1,img3,out3,img1,img2]).then(crypt.test_fn,[img1,img3],[input_key,input_address])
|