コード例 #1
0
        public void GetSaltedPasswdTest(string rawPwd, EnumHashAlgorithm eha, int saltLength)
        {
            try
            {
                // Get the Salt password using the components of touryo.
                string saltedPasswd = GetHash.GetSaltedPasswd(rawPwd, eha, saltLength);

                // Check salt password to see if they match.
                Assert.IsTrue(GetHash.EqualSaltedPasswd(rawPwd, saltedPasswd, eha, saltLength));

                // (Just in case) Salt length is different, make sure that the salt passwords do not match.
                Assert.IsFalse(GetHash.EqualSaltedPasswd(rawPwd, saltedPasswd, eha, saltLength + 1));
            }
            catch (Exception ex)
            {
                // Print a stack trace when an exception occurs.
                Console.WriteLine(ex.StackTrace);
                throw;
            }
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: ukayare/OpenTouryo
 /// <summary>塩味パスワード生成</summary>
 private void btnSPWDGen_Click(object sender, EventArgs e)
 {
     this.txtSPWDSaltedPassword.Text = GetHash.GetSaltedPasswd(
         this.txtSPWDRawPassword.Text, (EnumHashAlgorithm)this.cbxSPWDPV.SelectedValue, (int)this.nudSPWDSaltLength.Value);
 }