def oracle_old_passwd(password, username, uppercase=True):
 (IV, pad) = (('\x00' * 8), '\x00')
 if isinstance(username, unicode):
  username = unicode.encode(username, UNICODE_ENCODING)
 if isinstance(password, unicode):
  password = unicode.encode(password, UNICODE_ENCODING)
 unistr = ''.join((('\x00%s' % c) for c in (username + password).upper()))
 cipher = des(hexdecode('0123456789ABCDEF'), CBC, IV, pad)
 encrypted = cipher.encrypt(unistr)
 cipher = des(encrypted[(-8):], CBC, IV, pad)
 encrypted = cipher.encrypt(unistr)
 retVal = hexencode(encrypted[(-8):])
 return (retVal.upper() if uppercase else retVal.lower())

def oracle_old_passwd ( password , username , uppercase = True ) : ( IV , pad ) = ( ( '\x00' * 8 ) , '\x00' ) if isinstance ( username , unicode ) : username = unicode . encode ( username , UNICODE_ENCODING ) if isinstance ( password , unicode ) : password = unicode . encode ( password , UNICODE_ENCODING ) unistr = '' . join ( ( ( '\x00%s' % c ) for c in ( username + password ) . upper ( ) ) ) cipher = des ( hexdecode ( '0123456789ABCDEF' ) , CBC , IV , pad ) encrypted = cipher . encrypt ( unistr ) cipher = des ( encrypted [ ( - 8 ) : ] , CBC , IV , pad ) encrypted = cipher . encrypt ( unistr ) retVal = hexencode ( encrypted [ ( - 8 ) : ] ) return ( retVal . upper ( ) if uppercase else retVal . lower ( ) )
reference(s): URL .