public void HashingCompareHashWith_GetHash_CompareHash() { string password = "******"; string wrongPsw = "wrong"; var hash = NotebookCryptography.GetHash(password); Assert.IsTrue(NotebookCryptography.CompareHash(password, hash)); Assert.IsFalse(NotebookCryptography.CompareHash(wrongPsw, hash)); }
public void SaveReadHashKeyWith_SaveHashKey_ReadHashKey() { string password = "******"; var aHash = NotebookCryptography.GetHash(password); var aKey = NotebookCryptography.GenerateKey(); Assert.IsTrue(NotebookModelIO.SaveHashKey(aHash, aKey)); var extractHash = NotebookModelIO.ReadHashKey(true); var extractKey = NotebookModelIO.ReadHashKey(false); CollectionAssert.AreEqual(aHash, extractHash); CollectionAssert.AreEqual(aKey, extractKey); }