Ejemplo n.º 1
0
def at_encryption():
    alpa = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
    rev_alpa = alpa[::-1]
    msg = demo_var2.msg
    encry_text = ""

    for i in range(len(msg)):
        if msg[i] == chr(32):
            encry_text += " "
        else:
            for j in range(len(alpa)):
                if msg[i] == alpa[j]:
                    encry_text += rev_alpa[j]
                    break
                # if
            # inner for
        # if-else
    # for
    # print("Encrypted Text: {}".format(encry_text))
    at_encryption.message = format(encry_text)
    # print(at_encryption.message)

    # Checking y[1]: index

    if y[1] == "one":
        from one_e import demo_var1, cipher_encryption
        demo_var1()
        demo_var1.msg = at_encryption.message
        # print(demo_var1.msg)
        cipher_encryption()
        print("Last2 Encrypted form of message pass through different file is:" + cipher_encryption.unrea)
    elif y[1] == "three":
        from three_e import demo_var3, cipher_encryption_rail
        demo_var3()
        demo_var3.msg = at_encryption.message
        #    print(demo_var2.msg)
        cipher_encryption_rail()
        print("Last2 Encrypted form of message pass through different file is:" + cipher_encryption_rail.unread)
    elif y[1] == "four":
        from four_e import demo_var4, cipher_encryption_rot47
        demo_var4()
        demo_var4.msg = at_encryption.message
        #    print(demo_var2.msg)
        cipher_encryption_rot47()
        print("Last2 Encrypted form of message pass through different file is:" + cipher_encryption_rot47.unread)
    elif y[1] == "five":
        from five_e import demo_var5, cipher_encryption_rot18
        demo_var5()
        demo_var5.msg = at_encryption.message
        # print(demo_var1.msg)
        cipher_encryption_rot18()
        print("Last2 Encrypted form of message pass through different file is:" + cipher_encryption_rot18.unread)
    elif y[1] == "six":
        from six_e import cipher_encryption_xor, demo_var6
        demo_var6()
        demo_var6.msg = at_encryption.message
        # print(demo_var1.msg)
        cipher_encryption_xor()
        print("Last1 Encrypted form of message pass through different file is:" + cipher_encryption_xor.xorunread)
Ejemplo n.º 2
0
def cipher_encryption_xor():
    #msg = input("Enter message: ")
    msg = demo_var6.msg
    key = "5"

    encrypt_hex = ""
    key_itr = 0
    for i in range(len(msg)):
        temp = ord(msg[i]) ^ ord(key[key_itr])
        # zfill will pad a single letter hex with 0, to make it two letter pair
        encrypt_hex += hex(temp)[2:].zfill(2)
        key_itr += 1
        if key_itr >= len(key):
            # once all of the key's letters are used, repeat the key
            key_itr = 0

    # print("Encrypted Text: {}".format(encrypt_hex))
    cipher_encryption_xor.xorunread = format(encrypt_hex)

    # Checking y[1]: index
    if y[1] == "one":
        from one_e import demo_var1, cipher_encryption
        demo_var1()
        demo_var1.msg = cipher_encryption_xor.xorunread
        # print(demo_var1.msg)
        cipher_encryption()
        print(
            "Last5 Encrypted form of message pass through different file is:" +
            cipher_encryption.unrea)
    elif y[1] == "two":
        from two_e import demo_var2, at_encryption
        demo_var2()
        demo_var2.msg = cipher_encryption_xor.xorunread
        #    print(demo_var2.msg)
        at_encryption()
        print(
            "Last5 Encrypted form of message pass through different file is:" +
            at_encryption.message)
    elif y[1] == "three":
        from three_e import demo_var3, cipher_encryption_rail
        demo_var3()
        demo_var3.msg = cipher_encryption_xor.xorunread
        #    print(demo_var2.msg)
        cipher_encryption_rail()
        print(
            "Last5 Encrypted form of message pass through different file is:" +
            cipher_encryption_rail.unread)
    elif y[1] == "four":
        from four_e import demo_var4, cipher_encryption_rot47
        demo_var4()
        demo_var4.msg = cipher_encryption_xor.xorunread
        #    print(demo_var2.msg)
        cipher_encryption_rot47()
        print(
            "Last5 Encrypted form of message pass through different file is:" +
            cipher_encryption_rot47.unread)
    elif y[1] == "five":
        from five_e import demo_var5, cipher_encryption_rot18
        demo_var5()
        demo_var5.msg = cipher_encryption_xor.xorunread
        # print(demo_var1.msg)
        cipher_encryption_rot18()
        print(
            "Last3 Encrypted form of message pass through different file is:" +
            cipher_encryption_rot18.unread)
Ejemplo n.º 3
0
def cipher_encryption_rot47():
    # message = input("Enter message: ")
    key = 5
    msg = demo_var4.msg
    encryp_text = ""

    for i in range(len(msg)):
        temp = ord(msg[i]) + key
        if ord(msg[i]) == 32:
            encryp_text += " "
        elif temp > 126:
            temp -= 94
            encryp_text += chr(temp)
        else:
            encryp_text += chr(temp)
        # if-else
    # for
    # print("Encrypted Text: {}".format(encryp_text))
    cipher_encryption_rot47.unread = format(encryp_text)

    # Checking y[1]: index
    if y[1] == "two":
        from two_e import demo_var2, at_encryption
        demo_var2()
        demo_var2.msg = cipher_encryption_rot47.unread
        #    print(demo_var2.msg)
        at_encryption()
        print(
            "Last4 Encrypted form of message pass through different file is:" +
            at_encryption.message)
    elif y[1] == "three":
        from three_e import demo_var3, cipher_encryption_rail
        demo_var3()
        demo_var3.msg = cipher_encryption_rot47.unread
        #    print(demo_var2.msg)
        cipher_encryption_rail()
        print(
            "Last4 Encrypted form of message pass through different file is:" +
            cipher_encryption_rail.unread)
    elif y[1] == "one":
        from one_e import demo_var1, cipher_encryption
        demo_var1()
        demo_var1.msg = cipher_encryption_rot47.unread
        # print(demo_var1.msg)
        cipher_encryption()
        print(
            "Last4 Encrypted form of message pass through different file is:" +
            cipher_encryption.unrea)
    elif y[1] == "five":
        from five_e import demo_var5, cipher_encryption_rot18
        demo_var5()
        demo_var5.msg = cipher_encryption_rot47.unread
        # print(demo_var1.msg)
        cipher_encryption_rot18()
        print(
            "Last4 Encrypted form of message pass through different file is:" +
            cipher_encryption_rot18.unread)
    elif y[1] == "six":
        from six_e import cipher_encryption_xor, demo_var6
        demo_var6()
        demo_var6.msg = cipher_encryption_rot47.unread
        # print(demo_var1.msg)
        cipher_encryption_xor()
        print(
            "Last1 Encrypted form of message pass through different file is:" +
            cipher_encryption_xor.xorunread)
Ejemplo n.º 4
0
def cipher_encryption():
    key = "5"
    msg = demo_var1.msg
    encrypt_hex = ""
    key_itr = 0
    for i in range(len(msg)):
        temp = ord(msg[i]) ^ ord(key[key_itr])
        encrypt_hex += hex(temp)[2:].zfill(2)
        key_itr += 1
        if key_itr >= len(key):
            key_itr = 0

    # print("Encrypted Text: {}".format(encrypt_hex))
    cipher_encryption.unrea = format(encrypt_hex)

    # Checking y[1]: index

    if y[1] == "two":
        from two_e import demo_var2, at_encryption
        demo_var2()
        demo_var2.msg = cipher_encryption.unrea
        # print(demo_var2.msg)
        at_encryption()
        print(
            "Last7 Encrypted form of message pass through different file is:" +
            at_encryption.message)
    elif y[1] == "three":
        from three_e import demo_var3, cipher_encryption_rail
        demo_var3()
        demo_var3.msg = cipher_encryption.unrea
        #    print(demo_var2.msg)
        cipher_encryption_rail()
        print(
            "Last1 Encrypted form of message pass through different file is:" +
            cipher_encryption_rail.unread)
    elif y[1] == "four":
        from four_e import demo_var4, cipher_encryption_rot47
        demo_var4()
        demo_var4.msg = cipher_encryption.unrea
        #    print(demo_var2.msg)
        cipher_encryption_rot47()
        print(
            "Last1 Encrypted form of message pass through different file is:" +
            cipher_encryption_rot47.unread)
    elif y[1] == "five":
        from five_e import demo_var5, cipher_encryption_rot18
        demo_var5()
        demo_var5.msg = cipher_encryption.unrea
        # print(demo_var1.msg)
        cipher_encryption_rot18()
        print(
            "Last1 Encrypted form of message pass through different file is:" +
            cipher_encryption_rot18.unread)
    elif y[1] == "six":
        from six_e import cipher_encryption_xor, demo_var6
        demo_var6()
        demo_var6.msg = cipher_encryption.unrea
        # print(demo_var1.msg)
        cipher_encryption_xor()
        print(
            "Last1 Encrypted form of message pass through different file is:" +
            cipher_encryption_xor.xorunread)
Ejemplo n.º 5
0
            demo_var1()
            cipher_encryption()
            print("--- %s seconds ---" % (time.time() - start_time))
            exit()

        elif y[0] == "two":
            from two_e import at_encryption, demo_var2
            demo_var2()
            at_encryption()
            print("--- %s seconds ---" % (time.time() - start_time))
            exit()

        elif y[0] == "three":
            from three_e import cipher_encryption_rail, demo_var3
            demo_var3()
            cipher_encryption_rail()
            print("--- %s seconds ---" % (time.time() - start_time))
            exit()

        elif y[0] == "four":
            from four_e import cipher_encryption_rot47, demo_var4
            demo_var4()
            cipher_encryption_rot47()
            print("--- %s seconds ---" % (time.time() - start_time))
            exit()

        elif y[0] == "five":
            from five_e import cipher_encryption_rot18, demo_var5
            demo_var5()
            cipher_encryption_rot18()
            print("--- %s seconds ---" % (time.time() - start_time))
Ejemplo n.º 6
0
def cipher_encryption_rot18():
    rot5 = "5678901234"
    zeroToNine = "0123456789"
    rot_13_key = 5

    # print("msg can be alphanumeric")
    # msg = input("Enter msg: ").upper()
    msg = demo_var5.msg
    encryp_text = ""
    for i in range(len(msg)):
        temp = msg[i] + ""
        if ord(msg[i]) == 32:
            encryp_text += " "
        elif re.search('[\d\s]+', temp):
            # ROT5
            for j in range(len(zeroToNine)):
                if msg[i] == zeroToNine[j]:
                    encryp_text += rot5[j]
            # inner for
        elif re.search('[\w\s]+', temp):
            # ROT13
            ch_temp = ord(msg[i]) + rot_13_key
            if ord(msg[i]) == 32:
                encryp_text += " "
            elif ch_temp > 90:
                ch_temp -= 26
                encryp_text += chr(ch_temp)
            else:
                encryp_text += chr(ch_temp)
        # if-else
    # for

    # print("Encrypted Text: {}".format(encryp_text))
    cipher_encryption_rot18.unread = format(encryp_text)

    # Checking y[1]: index
    if y[1] == "one":
        from one_e import demo_var1, cipher_encryption
        demo_var1()
        demo_var1.msg = cipher_encryption_rot18.unread
        # print(demo_var1.msg)
        cipher_encryption()
        print(
            "Last5 Encrypted form of message pass through different file is:" +
            cipher_encryption.unrea)
    elif y[1] == "two":
        from two_e import demo_var2, at_encryption
        demo_var2()
        demo_var2.msg = cipher_encryption_rot18.unread
        #    print(demo_var2.msg)
        at_encryption()
        print(
            "Last5 Encrypted form of message pass through different file is:" +
            at_encryption.message)
    elif y[1] == "three":
        from three_e import demo_var3, cipher_encryption_rail
        demo_var3()
        demo_var3.msg = cipher_encryption_rot18.unread
        #    print(demo_var2.msg)
        cipher_encryption_rail()
        print(
            "Last5 Encrypted form of message pass through different file is:" +
            cipher_encryption_rail.unread)
    elif y[1] == "four":
        from four_e import demo_var4, cipher_encryption_rot47
        demo_var4()
        demo_var4.msg = cipher_encryption_rot18.unread
        #    print(demo_var2.msg)
        cipher_encryption_rot47()
        print(
            "Last5 Encrypted form of message pass through different file is:" +
            cipher_encryption_rot47.unread)
    elif y[1] == "six":
        from six_e import cipher_encryption_xor, demo_var6
        demo_var6()
        demo_var6.msg = cipher_encryption_rot18.unread
        # print(demo_var1.msg)
        cipher_encryption_xor()
        print(
            "Last1 Encrypted form of message pass through different file is:" +
            cipher_encryption_xor.xorunread)