Пример #1
0
        /// <summary>
        /// Checks if the current password hash needs rehashing
        /// </summary>
        /// <param name="password">Password that needs rehashing</param>
        /// <param name="opsLimit"></param>
        /// <param name="memLimit"></param>
        /// <returns></returns>
        public static bool ArgonPasswordNeedsRehash(byte[] password, long opsLimit, int memLimit)
        {
            if (password == null)
            {
                throw new ArgumentNullException("password", "Password cannot be null");
            }

            SodiumCore.Init();

            int status = SodiumLibrary.crypto_pwhash_str_needs_rehash(password, opsLimit, memLimit);

            if (status == -1)
            {
                throw new InvalidArgonPasswordString();
            }

            return(status == 1);
        }