docs: def crypt(word, salt=None, rounds=_ROUNDS_DEFAULT):
      """Return a string representing the one-way hash of a password, with a salt
      prepended.
      If ``salt`` is not specified or is ``None``, the strongest
      available method will be selected and a salt generated.  Otherwise,
      ``salt`` may be one of the ``crypt.METHOD_*`` values, or a string as
      returned by ``crypt.mksalt()``.
      """
      if salt is None or isinstance(salt, _Method):
          salt = mksalt(salt, rounds)
  
      algo, rounds, salt = extract_components_from_salt(salt)
      if algo == 5:
          hashfunc = hashlib.sha256
      elif algo == 6:
          hashfunc = hashlib.sha512
      else:
          raise ValueError('Unsupported algorithm, must be either 5 (sha256) or 6 (sha512)')
  
      return sha2_crypt(word, salt, hashfunc, rounds)