Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def compute(rc1):
""" Translated from MPlayer's source
Computes the realchallenge response and checksum """
buf = list()
buf.extend( RealChallenge.AV_WB32('a1e9149d') )
buf.extend( RealChallenge.AV_WB32('0e6b3b59') )
rc1 = rc1.strip()
if rc1:
if len(rc1) == 40: rc1 = rc1[:32]
if len(rc1) > 56: rc1 = rc1[:56]
buf.extend( [ ord(i) for i in rc1 ] )
buf.extend( [ 0 for i in range(0, 56 - len(rc1)) ] )
# xor challenge bytewise with xor_table
for i in range(0, len(RealChallenge.XOR_TABLE)):
buf[8 + i] ^= RealChallenge.XOR_TABLE[i];
sum = md5( ''.join([ chr(i) for i in buf ]) )
response = sum.hexdigest() + '01d0a8e3'
def compute(rc1):
""" Translated from MPlayer's source
Computes the realchallenge response and checksum """
buf = list()
buf.extend( RealChallenge.AV_WB32('a1e9149d') )
buf.extend( RealChallenge.AV_WB32('0e6b3b59') )
rc1 = rc1.strip()
if rc1:
if len(rc1) == 40: rc1 = rc1[:32]
if len(rc1) > 56: rc1 = rc1[:56]
buf.extend( [ ord(i) for i in rc1 ] )
buf.extend( [ 0 for i in range(0, 56 - len(rc1)) ] )
# xor challenge bytewise with xor_table
for i in range(0, len(RealChallenge.XOR_TABLE)):
buf[8 + i] ^= RealChallenge.XOR_TABLE[i];
sum = md5( ''.join([ chr(i) for i in buf ]) )