Spaces:
Runtime error
Runtime error
Update crypt.py
Browse files
crypt.py
CHANGED
@@ -14,23 +14,6 @@ import qrcode as qr
|
|
14 |
import math
|
15 |
from PIL import ImageFont, ImageDraw, Image
|
16 |
|
17 |
-
def address(im):
|
18 |
-
|
19 |
-
secret_code="SECRET PASSWORD"
|
20 |
-
priv_key = crypt.decode(im)
|
21 |
-
print(f'priv_key:: {priv_key}')
|
22 |
-
key = RSA.import_key(priv_key,passphrase=secret_code)
|
23 |
-
|
24 |
-
public_key = key.publickey().export_key('PEM')
|
25 |
-
file_out_pub = open("receiver.pem", "wb")
|
26 |
-
file_out_pub.write(public_key)
|
27 |
-
file_out_pub.close()
|
28 |
-
|
29 |
-
|
30 |
-
hash_1 = calculate_hash(public_key, hash_function="sha256")
|
31 |
-
hash_2 = calculate_hash(hash_1, hash_function="ripemd160")
|
32 |
-
address = base58.b58encode(hash_2)
|
33 |
-
print (address)
|
34 |
|
35 |
def process(img,font_text,font_fac,font_x,font_y,font_col,font_op):
|
36 |
img.save('tmp.png')
|
@@ -238,6 +221,23 @@ def conv_im(im,data):
|
|
238 |
im_out = encode(f'tmpim{uniqnum}.png',data)
|
239 |
return im_out
|
240 |
###################################
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
241 |
|
242 |
|
243 |
|
|
|
14 |
import math
|
15 |
from PIL import ImageFont, ImageDraw, Image
|
16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
|
18 |
def process(img,font_text,font_fac,font_x,font_y,font_col,font_op):
|
19 |
img.save('tmp.png')
|
|
|
221 |
im_out = encode(f'tmpim{uniqnum}.png',data)
|
222 |
return im_out
|
223 |
###################################
|
224 |
+
def address(im):
|
225 |
+
|
226 |
+
secret_code="SECRET PASSWORD"
|
227 |
+
priv_key = decode(im)
|
228 |
+
print(f'priv_key:: {priv_key}')
|
229 |
+
key = RSA.import_key(priv_key,passphrase=secret_code)
|
230 |
+
|
231 |
+
public_key = key.publickey().export_key('PEM')
|
232 |
+
file_out_pub = open("receiver.pem", "wb")
|
233 |
+
file_out_pub.write(public_key)
|
234 |
+
file_out_pub.close()
|
235 |
+
|
236 |
+
|
237 |
+
hash_1 = calculate_hash(public_key, hash_function="sha256")
|
238 |
+
hash_2 = calculate_hash(hash_1, hash_function="ripemd160")
|
239 |
+
address = base58.b58encode(hash_2)
|
240 |
+
print (address)
|
241 |
|
242 |
|
243 |
|