Skip to content

Commit

Permalink
Работа с оригинальным облаком
Browse files Browse the repository at this point in the history
  • Loading branch information
fandaymon committed Sep 13, 2020
1 parent bfda23a commit f82c9bc
Show file tree
Hide file tree
Showing 7 changed files with 512 additions and 70 deletions.
14 changes: 14 additions & 0 deletions modules/tuya/pow_python.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import sys
import math
import binascii
n=int(sys.argv[1])
e=int(sys.argv[2])
data=str.encode(sys.argv[3])
#print(n,e,data)
# you can get e/n using ".public_numbers()" on a cryptography _RSAPublicKey

keylength = math.ceil(n.bit_length() / 8)
input_nr = int.from_bytes(data, byteorder='big')
crypted_nr = pow(input_nr, e, n)
crypted_data = crypted_nr.to_bytes(keylength, byteorder='big')
print(binascii.hexlify(crypted_data))
Loading

0 comments on commit f82c9bc

Please sign in to comment.