码迷,mamicode.com
首页 > 编程语言 > 详细

Python异或加密字符串

时间:2014-08-11 11:27:22      阅读:2362      评论:0      收藏:0      [点我收藏+]

标签:blog   os   for   art   ar   div   log   python   

import os
import sys
import struct

def enc(path, key):
    path_ret = ""
    for i in range(0, len(path)/4):
        path_ret += struct.pack("<L", struct.unpack("<L", path[i*4 : (i*4)+4])[0] ^ key)

    return path_ret

print enc("daniel King ", 0x0)
print enc("daniel King ", 0xFFFFFFFF)
print enc(enc("daniel King ", 0xFFFFFFFF), 0xFFFFFFFF)

  

>>> ================================ RESTART ================================
>>> 
daniel King 
洖憱殦叽枒樳
daniel King 
>>> 

  

Python异或加密字符串,布布扣,bubuko.com

Python异或加密字符串

标签:blog   os   for   art   ar   div   log   python   

原文地址:http://www.cnblogs.com/long123king/p/3904118.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!