def generate_extended_token(cls, starting_code, key, value, count, restricted_digit_set=False): starting_code_base = OPAYGOSharedExtended.get_token_base(starting_code) token_base = cls._encode_base_extended(starting_code_base, value) current_token = OPAYGOSharedExtended.put_base_in_token(starting_code, token_base) new_count = count + 1 for xn in range(1, new_count): current_token = OPAYGOSharedExtended.generate_next_token(current_token, key) final_token = OPAYGOSharedExtended.put_base_in_token(current_token, token_base) if restricted_digit_set: final_token = OPAYGOSharedExtended.convert_to_4_digit_token(final_token) return final_token
def get_activation_value_count_from_extended_token( cls, token, starting_code, key, last_count, restricted_digit_set=False): if restricted_digit_set: token = OPAYGOSharedExtended.convert_from_4_digit_token(token) token_base = OPAYGOSharedExtended.get_token_base( token) # We get the base of the token current_code = OPAYGOSharedExtended.put_base_in_token( starting_code, token_base) # We put it into the starting code starting_code_base = OPAYGOSharedExtended.get_token_base( starting_code) # We get the base of the starting code value = cls._decode_base_extended( starting_code_base, token_base) # If there is a match we get the value from the token for count in range(0, 30): masked_token = OPAYGOSharedExtended.put_base_in_token( current_code, token_base) if masked_token == token and count > last_count: clean_count = count - 1 return value, clean_count current_code = OPAYGOSharedExtended.generate_next_token( current_code, key) # If not we go to the next token return None, None, None