版权所有,转载请注明出处与作者
# -*- coding: iso-8859-1 -*-
#!/usr/bin/python
# Author:JiangXiaoQiang
# E-mail:athlong@hotmail.com
# Webpage:www.awrhyme.cn
import binascii
q=[]
def crc64(msg):
s0=00
s2=00
s3=00
s1=00
i=0
j=0
restr=''
l=len(msg)
while i<l:
s0^=ord(msg[i])
s1^=ord(msg[i+1])
s2^=ord(msg[i+2])
s3^=ord(msg[i+3])
i+=4
q.append(~s0)
q.append(~s1)
q.append(~s2)
q.append(~s3)
while j<4:
restr+=contr(q[j])
j+=1
return restr.replace('0x','').upper()
def contr(q):
high = (q& 0xf0) >> 4
low = (q& 0xf)
print 'high',high,'low',low
return(str(hex(high))+str(hex(low)))