def sendMail():
    friend = efriend.get()  #发给谁
    sendStr = esend.get()  #发送的消息

    #用MD5生成消息摘要
    abstract = MD5.md5(sendStr)

    #用RSA算法对消息摘要进行签名
    signal1 = RSA.sign(str(abstract))

    #生成消息
    message = sendStr + '@' + str(signal1)

    #用RC4算法对消息进行加密
    key = "569716548"
    box = RC4.init_box(key)
    cipher = RC4.ex_encrypt(message, box)

    #发送消息
    sendStr = friend + ":" + cipher
    ck.send(sendStr.encode("utf-8"))
Exemple #2
0
        out_put = md5.hex_digest()
        print out_put
        end = time.clock()
        print('--------------------------MD5 end--------------------------\n')
        print('Cost ' + str(end - start) + 's\n')
        costdic[choose] = end - start
    elif choose == 7:
        print('--------------------------RC4--------------------------\n')
        mode = raw_input("1 Encrypt or 2 Decode \n")
        if mode == '1':
            start = time.clock()

            message = RC4.get_message()
            key = RC4.get_key()
            box = RC4.init_box(key)
            RC4.ex_encrypt(message, box, mode)
            end = time.clock()

        elif mode == '2':
            message = RC4.get_message()
            key = RC4.get_key()
            box = RC4.init_box(key)
            RC4.ex_encrypt(message, box, mode)
        print('--------------------------RC4 end--------------------------\n')
        print('Cost ' + str(end - start) + 's\n')
        costdic[choose] = end - start
    elif choose == 8:
        print('--------------------------A5--------------------------\n')

        choice = raw_input("1 Encrypt or 2 Decode \n")
        if choice == '1':