def __init__(self, salt='', min_length=0, alphabet=ALPHABET):
        """
        Initializes a Hashids object with salt, minimum length, and alphabet.

        :param salt: A string influencing the generated hash ids.
        :param min_length: The minimum length for generated hashes
        :param alphabet: The characters to use for the generated hash ids.
        """
        self._min_length = max(int(min_length), 0)
        self._salt = salt

        separators = ''.join(x for x in 'cfhistuCFHISTU' if x in alphabet)
        alphabet = ''.join(x for i, x in enumerate(alphabet)
                           if alphabet.index(x) == i and x not in separators)

        len_alphabet, len_separators = len(alphabet), len(separators)
        if len_alphabet + len_separators < 16:
            raise ValueError('Alphabet must contain at least 16 '
                             'unique characters.')

        separators = _reorder(separators, salt)

        min_separators = _index_from_ratio(len_alphabet, RATIO_SEPARATORS)

        number_of_missing_separators = min_separators - len_separators
        if number_of_missing_separators > 0:
            separators += alphabet[:number_of_missing_separators]
            alphabet = alphabet[number_of_missing_separators:]
            len_alphabet = len(alphabet)

        alphabet = _reorder(alphabet, salt)
        num_guards = _index_from_ratio(len_alphabet, RATIO_GUARDS)
        if len_alphabet < 3:
            guards = separators[:num_guards]
            separators = separators[num_guards:]
        else:
            guards = alphabet[:num_guards]
            alphabet = alphabet[num_guards:]

        self._alphabet = alphabet
        self._guards = guards
        self._separators = separators

        # Support old API
        self.decrypt = _deprecated(self.decode)
        self.encrypt = _deprecated(self.encode)
def __init__ ( self , salt = '' , min_length = 0 , alphabet = ALPHABET ) : self . _min_length = max ( int ( min_length ) , 0 ) self . _salt = salt separators = '' . join ( x for x in 'cfhistuCFHISTU' if x in alphabet ) alphabet = '' . join ( x for i , x in enumerate ( alphabet ) if alphabet . index ( x ) == i and x not in separators ) len_alphabet , len_separators = len ( alphabet ) , len ( separators ) if len_alphabet + len_separators < 16 : raise ValueError ( 'Alphabet must contain at least 16 ' 'unique characters.' ) separators = _reorder ( separators , salt ) min_separators = _index_from_ratio ( len_alphabet , RATIO_SEPARATORS ) number_of_missing_separators = min_separators - len_separators if number_of_missing_separators > 0 : separators += alphabet [ : number_of_missing_separators ] alphabet = alphabet [ number_of_missing_separators : ] len_alphabet = len ( alphabet ) alphabet = _reorder ( alphabet , salt ) num_guards = _index_from_ratio ( len_alphabet , RATIO_GUARDS ) if len_alphabet < 3 : guards = separators [ : num_guards ] separators = separators [ num_guards : ] else : guards = alphabet [ : num_guards ] alphabet = alphabet [ num_guards : ] self . _alphabet = alphabet self . _guards = guards self . _separators = separators self . decrypt = _deprecated ( self . decode ) self . encrypt = _deprecated ( self . encode )
Initializes a Hashids object with salt, minimum length, and alphabet.

        :param salt: A string influencing the generated hash ids.
        :param min_length: The minimum length for generated hashes
        :param alphabet: The characters to use for the generated hash ids.