def decode_id(encoded, secret): encoded_int = num_decode(decode(encoded)) secret = str(secret) if not secret.isdigit(): secret = num_decode(secret) result = encoded_int ^ secret return result
def encode_id(id, secret): secret = str(secret) if not secret.isdigit(): secret = num_decode(secret) id, secret = map(int, (id, secret)) result = id ^ secret return encode(num_encode(result))