コード例 #1
0
        /// <summary>
        /// hash the password
        /// </summary>
        /// <param name="password"></param>
        /// <returns></returns>
        private byte[] HashPassword(string password)
        {
            //Org.BouncyCastle.Crypto.Digests.Sha3Digest sha = new Org.BouncyCastle.Crypto.Digests.Sha3Digest(512);
            //this._Password = new byte[sha.GetByteLength()];
            //sha.BlockUpdate(password.GetBytes(), 0, password.Length);
            //sha.DoFinal(this._Password, 0);
            //return this._Password;

            Blake2b hash = new Blake2b(512);
            //this._Password = new byte[sha.GetHashLength()];
            //sha.Update(password);
            //sha.DoFinal(this._Password, 0);
            //return this._Password;

            PBKDF2 pbkdf = new PBKDF2(hash, this._PasswordIteration);

            return(pbkdf.Derive(password.GetBytes(), null, (this._PasswordIteration) * hash.GetHashLength()));
        }