Exemplo n.º 1
0
def encryption(plain, key):
    inp = to_hex(pad(plain))
    key = to_hex(pad(key))[0]

    ct = []
    for block in inp:
        ct.append(encrypt(block, key))
    return ct
Exemplo n.º 2
0
def decryption(cipher, key):
    dt = []
    key = to_hex(pad(key))[0]

    for block in cipher:
        dt.append(decrypt(block, key))
    final = ""
    for block in dt:
        final += to_str(block)
    return rmpad(final)
Exemplo n.º 3
0
def decryption(cipher, key):
    dt = []
    key = to_hex(pad(key))[0]

    for block in cipher:
        dt.append(decrypt(block, key))
    final = ""
    for block in dt:
        final += to_str(block)
    return rmpad(final)
Exemplo n.º 4
0
from encrypt import pad, to_hex, encrypt
from decrypt import rmpad, to_str, decrypt

plain = input("Enter Plain Text: ")
key = input("Enter Key: ")

# print("Plain Text: ", plain)
# print("Key: ", key)

print("\n-------------------- Encryption ----------------------\n")

inp = to_hex(pad(plain))
key = to_hex(pad(key))[0]

ct = []
for block in inp:
    ct.append(encrypt(block, key))

encrypted_text = ""
for block in ct:
    encrypted_text += to_str(block)

print("\n")
print("Encrypted Text: ", encrypted_text)
print("\n")

print("\n-------------------- Decryption ----------------------\n")

dt = []
for block in ct:
    dt.append(decrypt(block, key))