예제 #1
0
def Test2():
    Message = '\nA very very very very long text message to be encrypted!' * 10
    print('Text Message:  ', Message)
    Key = 'Some Random Secret Key'

    msg = DES.check_msg(Message)
    K = DES.check_key(Key)

    print('Encrypted Text:', end=' ')
    cipher = DES.encryption(K, msg)
    print(cipher)

    print('Decrypted Text:', end=' ')
    Message = DES.decryption(K, cipher)
    print(Message)
예제 #2
0
        except ValueError:
            print('Indicate your choice by typing only a number!')
            continue

        if ch == 1:
            Message = input('Enter your message to be encrypted: ')
            Key = input('Enter the encryption key: ')
            msg = DES.check_msg(Message)
            K = DES.check_key(Key)

            print('Encrypted Text:', end=' ')
            cipher = DES.encryption(K, msg)
            print(cipher)

        elif ch == 2:
            cipher = input('Enter your cipher text to be decrypted: ')
            Key = input('Enter the encryption key: ')
            msg = DES.check_msg(cipher)
            K = DES.check_key(Key)

            print('Decrypted Text:', end=' ')
            Message = DES.decryption(K, cipher)
            print(Message)

        elif ch == 0:
            print('Exit....')
            break

        else:
            print('Wrong input!')