Exemplo n.º 1
0
        private ReadOnlyMemory <byte> String2Key(byte[] password, string salt, byte[] param)
        {
            var passwordBytes = KerberosConstants.UnicodeBytesToUtf8(password);

            var iterations = GetIterations(param, 4096);

            var saltBytes = KerberosConstants.UnicodeStringToUtf8(salt);

            var random = PBKDF2(passwordBytes, saltBytes, iterations, KeySize);

            return(DK(random, KerberosConstant, KeySize, BlockSize));
        }
Exemplo n.º 2
0
        private ReadOnlySpan <byte> String2Key(byte[] password, string salt, byte[] param)
        {
            var passwordBytes = KerberosConstants.UnicodeBytesToUtf8(password);

            var iterations = GetIterations(param, 4096);

            var saltBytes = GetSaltBytes(salt, null);

            var random = PBKDF2(passwordBytes, saltBytes, iterations, KeySize);

            var tmpKey = Random2Key(random);

            return(DK(tmpKey, KerberosConstant.Span, KeySize, BlockSize));
        }