当前位置:首页 > 开发 > 编程语言 > 加密解密 > 正文

一种有意思的加密解密

发表于: 2015-05-05   作者:cooler1217   来源:转载   浏览:
摘要: #encoding=utf-8 ''' Created on 2014-12-9 @author: cooler ''' #加密过程: head = "4" end = "F" oldstr = "68f7284f61557429af55dfa1" serial = (int(head,16) + int


#encoding=utf-8
'''
Created on 2014-12-9

@author: cooler
'''
#加密过程:
head = "4"
end = "F"
oldstr = "68f7284f61557429af55dfa1"
serial = (int(head,16) + int(end,16))%13
newstr = oldstr[serial:24] + oldstr[0:serial]
authstr = head + newstr + end
print "oldstr = ",oldstr
print "newstr = ", newstr
print "authstr = " , authstr
print serial
print "-----------------------------"
#解密函数:
def decodeAuth(authstr):
	print "authstr = " , authstr
	head = authstr[0]
	end = authstr[25]
	serial = (int(head,16) + int(end,16))%13
	print serial
	oldstr = authstr[1:25]
	print " auth[1]-----auth[24]  ",oldstr
	newstr = oldstr[(24-serial):24] + oldstr[0:(24-serial)]
	print "_auth[1]------_auth[24]  ", newstr
	print "dname = ",newstr[0:12]
	print "uname = ",newstr[12:24]
	return newstr
decodeAuth(authstr)

一种有意思的加密解密

  • 0

    开心

    开心

  • 0

    板砖

    板砖

  • 0

    感动

    感动

  • 0

    有用

    有用

  • 0

    疑问

    疑问

  • 0

    难过

    难过

  • 0

    无聊

    无聊

  • 0

    震惊

    震惊

版权所有 IT知识库 CopyRight © 2009-2015 IT知识库 IT610.com , All Rights Reserved. 京ICP备09083238号