Ejemplo n.º 1
0
        /// <summary>
        /// Creaetes a new passhash from the password string value
        /// </summary>
        public static Passhash PasswordToPasshash(string password, int iterationCount = ushort.MaxValue)
        {
            if (!IsPasswordValidLength(password.Length))
            {
                throw new ArgumentException("Invalid password length");
            }

            var hash = Cryptographer.ToSHA512(password, Encoding.UTF8, iterationCount);

            return(new Passhash(hash));
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Creates a new cryptographically secure token instance
 /// </summary>
 public static Token Create()
 {
     return(new Token(Cryptographer.GetSecureRandom(ByteSize)));
 }