首页 > 编程语言 > 详细

Python异或加密字符串

时间:2014-08-11 11:27:22      阅读:926      评论:0      收藏:0      [点我收藏+]
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异或加密字符串

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!