def safe_string_equals(a, b):
 if (len(a) != len(b)):
  return False
 result = 0
 for (x, y) in zip(a, b):
  result |= (ord(x) ^ ord(y))
 return (result == 0)

def safe_string_equals ( a , b ) : if ( len ( a ) != len ( b ) ) : return False result = 0 for ( x , y ) in zip ( a , b ) : result |= ( ord ( x ) ^ ord ( y ) ) return ( result == 0 )
near-constant time string comparison .