Пример #1
0
def Decryp_Affine_t(arg1,arg2,arg3):
    data = arg1
    key1 = int(arg2)
    key2 = int(arg3)
    key=[key1,key2]
    cm = SaveSpaces(SaveCase(CryptMachine(Affine(),key)))
    return(cm.decrypt(data))
Пример #2
0
def Decryp_Affine():
    data = input("Enter dtata to be Decrypted By Affine Algorithm : ")
    key1 = int(input("Enter key1 : "))
    key2 = int(input("Enter key2 : "))
    key=[key1,key2]
    cm = SaveSpaces(SaveCase(CryptMachine(Affine(),key)))
    print(cm.decrypt(data))
    input("Copy if needed.............")
Пример #3
0
def Decryp_Vigenere():
    data = input("Enter dtata to be Decrypted By Vigenere Algorithm : ")
    key = input("Enter key : ")
    cm = SaveSpaces(SaveCase(CryptMachine(Vigenere(),key)))
    print(cm.decrypt(data))
    input("Copy if needed.............")
Пример #4
0
def Encryp_Vigenere():
    data = input("Enter data to be Encrypted with Vigenere algorithm : ")
    key = input("Enter key : ")
    cm = SaveSpaces(SaveCase(CryptMachine(Vigenere(),key)))
    print(cm.encrypt(data))
    input("Copy if needed.............")
Пример #5
0
def Decryp_Rot_13():
    data = input("Enter dtata to be Decrypted By Rot-13 Algorithm : ")
    cm = SaveSpaces(SaveCase(CryptMachine(Rot13())))
    print(cm.decrypt(data))
    input("Copy if needed.............")
Пример #6
0
def Encryp_Rot_13():
    data = input("Enter data to be Encrypted with Rot-13 algorithm : ")
    cm = SaveSpaces(SaveCase(CryptMachine(Rot13())))
    print(cm.encrypt(data))
    input("Copy if needed.............")
Пример #7
0
#!/usr/bin/python
# -*- encoding: utf-8 -*-

from secretpy import Rot47
from secretpy import CryptMachine
from secretpy.cmdecorators import SaveSpaces


def encdec(machine, plaintext):
    print("----------------------------------")
    print(plaintext)
    enc = machine.encrypt(plaintext)
    print(enc)
    dec = machine.decrypt(enc)
    print(dec)


cm = SaveSpaces(CryptMachine(Rot47()))

plaintext = u"The man has 536 dogs"
encdec(cm, plaintext)
Пример #8
0
from secretpy.cmdecorators import SaveCase, SaveSpaces
from secretpy import alphabet


def encdec(machine, plaintext):
    print("----------------------------------")
    print(plaintext)
    enc = machine.encrypt(plaintext)
    print(enc)
    dec = machine.decrypt(enc)
    print(dec)


cm = SaveCase(CryptMachine(Rot13()))

plaintext = u"thisisasecretmessage"
encdec(cm, plaintext)

cm = SaveSpaces(cm)

plaintext = u"Why did the chicken cross the road Gb trg gb gur bgure fvqr"
encdec(cm, plaintext)

plaintext = u"thequickbrownfoxjumpsoverthelazydog"
cm.set_alphabet(alphabet.GERMAN)
encdec(cm, plaintext)

plaintext = u"текст"
cm.set_alphabet(alphabet.RUSSIAN)
encdec(cm, plaintext)
Пример #9
0
def Decryp_Vigenere_t(arg1,arg2):
    data = arg1
    key = arg2
    cm = SaveSpaces(SaveCase(CryptMachine(Vigenere(),key)))
    return(cm.decrypt(data))
Пример #10
0
def Decryp_Rot_13_t(arg1):
    data = arg1
    cm = SaveSpaces(SaveCase(CryptMachine(Rot13())))
    return(cm.decrypt(data))
Пример #11
0
def Decryp_Keyword_t(arg1,arg2):
    data = arg1
    key = arg2
    cm = SaveSpaces(SaveCase(CryptMachine(Keyword(),key)))
    return(cm.decrypt(data))
Пример #12
0
def Decryp_ceaser_t(arg1, arg2):
    data = arg1
    key = int(arg2)
    cm = SaveSpaces(SaveCase(CryptMachine(Caesar(), key)))
    return(cm.decrypt(data))
Пример #13
0
from secretpy import Chao, CryptMachine, alphabets
from secretpy.cmdecorators import UpperCase, SaveSpaces


def encdec(machine, plaintext):
    print(plaintext)
    enc = machine.encrypt(plaintext)
    print(enc)
    print(machine.decrypt(enc))
    print("-------------------------------")


alphabet = "ptlnbqdeoysfavzkgjrihwxumc"  # RIGHT WHEEL PT
key = "hxuczvamdslkpefjrigtwobnyq"  # LEFT WHEEL CT

cm = SaveSpaces(UpperCase(CryptMachine(Chao(), key)))
cm.set_alphabet(alphabet)

plaintext = "well done is better than well said"
encdec(cm, plaintext)

plaintext = "plaintext"
encdec(cm, plaintext)

cm.set_alphabet(alphabets.ENGLISH)
cm.set_key(alphabets.ENGLISH)
plaintext = "do not use pc"
encdec(cm, plaintext)
'''
Output:
Пример #14
0
def Encryp_Bifid():
    data = input("Enter data to be Encrypted with Bifid algorithm : ")
    key =int(input("Enter key : "))
    cm = SaveSpaces(SaveCase(CryptMachine(Bifid(),key)))
    print(cm.encrypt(data))
    input("Copy if needed.............")
Пример #15
0
def Decryp_Bifid_t(arg1,arg2):
    data = arg1
    key =int(arg2)
    cm = SaveSpaces(SaveCase(CryptMachine(Bifid(),key)))
    return(cm.decrypt(data))
Пример #16
0
def Decryp_Bifid():
    data = input("Enter dtata to be Decrypted By Bifid Algorithm : ")
    key =int(input("Enter key : "))
    cm = SaveSpaces(SaveCase(CryptMachine(Bifid(),key)))
    print(cm.decrypt(data))
    input("Copy if needed.............")
Пример #17
0
def Decryp_ceaser():
    data = input("Enter dtata to be Decrypted By Ceaser Algorithm : ")
    key = int(input("Enter key to be Ency : "))
    cm = SaveSpaces(SaveCase(CryptMachine(Caesar(), key)))
    print(cm.decrypt(data))
    input("Copy if needed.............")
Пример #18
0
from secretpy import Rot18
from secretpy import CryptMachine
from secretpy.cmdecorators import SaveCase, SaveSpaces, UpperCase
from secretpy import alphabets


def encdec(machine, plaintext):
    print("----------------------------------")
    print(plaintext)
    enc = machine.encrypt(plaintext)
    print(enc)
    dec = machine.decrypt(enc)
    print(dec)


cm = SaveCase(SaveSpaces(CryptMachine(Rot18())))

plaintext = u"The man has 536 dogs"
encdec(cm, plaintext)

plaintext = alphabets.RUSSIAN + alphabets.DECIMAL
cm.set_alphabet(alphabets.RUSSIAN)
encdec(cm, plaintext)

plaintext = u"У человека 536 собак"
encdec(cm, plaintext)

plaintext = alphabets.GREEK + " " + alphabets.DECIMAL
cm = UpperCase(cm)
cm.set_alphabet(alphabets.GREEK)
encdec(cm, plaintext)
Пример #19
0

def encdec(machine, plaintext):
    print("=======================================")
    print(plaintext)
    enc = machine.encrypt(plaintext)
    print(enc)
    dec = machine.decrypt(enc)
    print(dec)


key = 5
plaintext = u"Dog jumps four times and cat six times"
print(plaintext)

cm1 = SaveSpaces(SaveCase(CryptMachine(Caesar(), key)))
enc = cm1.encrypt(plaintext)
print(enc)

cm2 = SaveSpaces(SaveCase(CryptMachine(Rot13())))
enc = cm2.encrypt(enc)
print(enc)

print("=======================================")

cm = CompositeMachine(cm1)
cm.add_machines(cm2)
enc = cm.encrypt(plaintext)
print(enc)

encdec(cm, plaintext)