hash = encode("One Million Uzbek Coders", 2)




Download 0,98 Mb.
Pdf ko'rish
bet10/10
Sana04.01.2024
Hajmi0,98 Mb.
#130238
1   2   3   4   5   6   7   8   9   10
Bog'liq
Kriptografik algoritmlar elektron pul
ТАБИАТШУНОСЛИК КУЛЛАНМА, baholar 6-22, SHAHAR TEST, Kiber huquq, Kriptografiyasiga kirish (1), Mustaqil ish yuzi blankasi yuzi
hash = encode("One Million Uzbek Coders", 2)
print(hash)


// Shifrlangan ma'lumotni 2 ta orqaga surilish tartibida tiklaymiz
res = decode(hash, 2)
print(res)
@raxmatillo, [08.12.2022 22:57]
from Crypto.PublicKey import RSA
key = RSA.generate(2048)
private_key = key.export_key()
file_out = open("private.pem", "wb")
file_out.write(private_key)
file_out.close()
public_key = key.publickey().export_key()
file_out = open("receiver.pem", "wb")
file_out.write(public_key)
file_out.close()


from Crypto.PublicKey import RSA
from Crypto.Random import get_random_bytes
from Crypto.Cipher import AES, PKCS1_OAEP
data
=
"Ushbu
ma'lumot
Alisa
tomonidan
bobga
yuborilgan !".encode("utf-8")
file_out = open("encrypted_data.bin", "wb")
recipient_key = RSA.import_key(open("receiver.pem").read())
session_key = get_random_bytes(16)
cipher_rsa = PKCS1_OAEP.new(recipient_key)
enc_session_key = cipher_rsa.encrypt(session_key)
cipher_aes = AES.new(session_key, AES.MODE_EAX)
ciphertext, tag = cipher_aes.encrypt_and_digest(data)


[ file_out.write(x) for x in (enc_session_key, cipher_aes.nonce, tag,
ciphertext) ]
file_out.close();

Download 0,98 Mb.
1   2   3   4   5   6   7   8   9   10




Download 0,98 Mb.
Pdf ko'rish

Bosh sahifa
Aloqalar

    Bosh sahifa



hash = encode("One Million Uzbek Coders", 2)

Download 0,98 Mb.
Pdf ko'rish