docs: def scrypt_mcf(password, salt=None, N=SCRYPT_N, r=SCRYPT_r, p=SCRYPT_p,
                 prefix=SCRYPT_MCF_PREFIX_DEFAULT):
      """Derives a Modular Crypt Format hash using the scrypt KDF
  
      Parameter space is smaller than for scrypt():
      N must be a power of two larger than 1 but no larger than 2 ** 31
      r and p must be positive numbers between 1 and 255
      Salt must be a byte string 1-16 bytes long.
  
      If no salt is given, a random salt of 128+ bits is used. (Recommended.)
      """
      if isinstance(password, unicode):
          password = password.encode('utf8')
      elif not isinstance(password, bytes):
          raise TypeError('password must be a unicode or byte string')
      if N < 2 or (N & (N - 1)):
          raise ValueError('scrypt N must be a power of 2 greater than 1')
      if p > 255 or p < 1:
          raise ValueError('scrypt_mcf p out of range [1,255]')
      if N > 2**31:
          raise ValueError('scrypt_mcf N out of range [2,2**31]')
  
      if (salt is not None or r != 8 or (p & (p - 1)) or (N*p <= 512) or
          prefix not in (SCRYPT_MCF_PREFIX_7, SCRYPT_MCF_PREFIX_s1,
                         SCRYPT_MCF_PREFIX_ANY) or
          _scrypt_ll):
          return mcf_mod.scrypt_mcf(scrypt, password, salt, N, r, p, prefix)
  
      s = next(i for i in range(1, 32) if 2**i == N)
      t = next(i for i in range(0, 8) if 2**i == p)
      m = 2**(10 + s)
      o = 2**(5 + t + s)
      mcf = ctypes.create_string_buffer(102)
      if _scrypt_str(mcf, password, len(password), o, m) != 0:
          return mcf_mod.scrypt_mcf(scrypt, password, salt, N, r, p, prefix)
  
      if prefix in (SCRYPT_MCF_PREFIX_7, SCRYPT_MCF_PREFIX_ANY):
          return mcf.raw.strip(b'\0')
  
      _N, _r, _p, salt, hash, olen = mcf_mod._scrypt_mcf_decode_7(mcf.raw[:-1])
      assert _N == N and _r == r and _p == p, (_N, _r, _p, N, r, p, o, m)
      return mcf_mod._scrypt_mcf_encode_s1(N, r, p, salt, hash)