public void Create_Md5() { var hash = CryptPassword.Create("Test", CryptPasswordAlgorithm.MD5); Assert.True(CryptPassword.Verify("Test", hash)); Assert.False(CryptPassword.Verify("NotTest", hash)); Assert.Equal(8, hash.Split('$')[2].Length); // default salt length }
public void Create_Md5_Verify_NoSalt() { Assert.True(CryptPassword.Verify("Test", "$1$$smLce1bQjZePWXbJ5eh58/")); Assert.False(CryptPassword.Verify("Test", "$1$$smLce1bQjZePWXbJ5eh580")); }
public void Create_Md5_Verify2() { Assert.True(CryptPassword.Verify("password", "$1$3azHgidD$SrJPt7B.9rekpmwJwtON31")); Assert.False(CryptPassword.Verify("password", "$1$3azHgidD$SrJPt7B.9rekpmwJwtON30")); }
public void Create_Md5_Verify1() { Assert.True(CryptPassword.Verify("Test", "$1$SALT$iYTuv61EcPDadxVotGguH0")); Assert.False(CryptPassword.Verify("Test", "$1$SALT$iYTuv61EcPDadxVotGguHF")); }
public void Input_EmptyHash() { Assert.False(CryptPassword.Verify("Test", "")); }
public void Input_NullHash() { Assert.False(CryptPassword.Verify("Test", null)); }
public void Create_Sha256_Verify_NoSalt() { Assert.True(CryptPassword.Verify("Test", "$5$$HznmDc1T0z.rHKK6lKLl06rT2QuK1hhSbA09Zur2KsD")); Assert.False(CryptPassword.Verify("Test", "$5$$HznmDc1T0z.rHKK6lKLl06rT2QuK1hhSbA09Zur2Ks0")); }
public void Create_Md5Apache_Verify2() { Assert.True(CryptPassword.Verify("myPassword", "$apr1$qHDFfhPC$nITSVHgYbDAK1Y0acGRnY0")); }
public void Create_Sha512_Verify_ExtraLongPassword() { Assert.True(CryptPassword.Verify("a very much longer text to encrypt. This one even stretches over morethan one line.", "$6$rounds=1400$anotherlongsalts$POfYwTEok97VWcjxIiSOjiykti.o/pQs.wPvMxQ6Fm7I6IoYN3CmLs66x9t0oSwbtEW7o7UmJEiDwGqd8p4ur1")); }
public void Create_Sha512_Verify_SaltTooLong() { Assert.True(CryptPassword.Verify("Hello world!", "$6$rounds=10000$saltstringsaltst$OW1/O6BYHV6BcXZu8QVeXbDWra3Oeqh0sbHbbMCVNSnCM/UrjmM0Dp8vOuZeHBy/YTBmSK6H9qs/y3RnOaw5v.")); }
public void Create_Sha512_Verify_NoSalt() { Assert.True(CryptPassword.Verify("Test", "$6$$A2vGKWUkCCh28GOsloAzFlH9OgSh8Kv37fsIgM/FmwIPpmZXE/Rx6h6Fdjw7bEasMtpE/e9QQL9Te0d1pUJk./")); Assert.False(CryptPassword.Verify("Test", "$6$$A2vGKWUkCCh28GOsloAzFlH9OgSh8Kv37fsIgM/FmwIPpmZXE/Rx6h6Fdjw7bEasMtpE/e9QQL9Te0d1pUJk.0")); }
public void Create_Sha512_Verify() { Assert.True(CryptPassword.Verify("Test", "$6$SALT$8GXK57PY.bq4j7Ng3f0LF6NcPXxUXqmmseKtw1ugn8uoKXiPJWG8Ub6bxJcHAPBL2y0ppLmQJcpR8mYJbdjVF1")); Assert.False(CryptPassword.Verify("Test", "$6$SALT$8GXK57PY.bq4j7Ng3f0LF6NcPXxUXqmmseKtw1ugn8uoKXiPJWG8Ub6bxJcHAPBL2y0ppLmQJcpR8mYJbdjVF0")); }
public void Create_Sha256_ExtraLongPassword() { Assert.True(CryptPassword.Verify("we have a short salt string but not a short password", "$5$rounds=77777$short$JiO1O3ZpDAxGJeaDIuqCoEFysAe1mZNJRs3pw0KQRd/")); }
public void Create_Sha256_SaltTooLong() { Assert.True(CryptPassword.Verify("Hello world!", "$5$rounds=10000$saltstringsaltst$3xv.VbSHBb41AL9AvLeujZkZRBAwqFMz2.opqey6IcA")); }
public void Create_Md5Apache_Verify1() { Assert.True(CryptPassword.Verify("Test", "$apr1$8fNPKrzo$LMfFH4wsbetnSxVk8zvnL/")); Assert.False(CryptPassword.Verify("Test", "$apr1$8fNPKrzo$LMfFH4wsbetnSxVk8zvnL0")); }
public void Create_Md5_Long() { var hash = CryptPassword.Create("ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ", CryptPasswordAlgorithm.MD5); Assert.True(CryptPassword.Verify("ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ", hash)); }
public void Input_UnknownAlgorithm() { Assert.False(CryptPassword.Verify("Test", "$XXX$SALT$8GXK57PY.bq4j7Ng3f0LF6NcPXxUXqmmseKtw1ugn8uoKXiPJWG8Ub6bxJcHAPBL2y0ppLmQJcpR8mYJbdjVF1")); }
public void Create_Md5Apache_Verify_NoSalt() { Assert.True(CryptPassword.Verify("Test", "$apr1$$zccNMO7jOau6cLaAIpdIp1")); Assert.False(CryptPassword.Verify("Test", "$apr1$$zccNMO7jOau6cLaAIpdIp0")); }
public void Create_Sha256_Verify() { Assert.True(CryptPassword.Verify("Test", "$5$SALT$hRDk2PDSQpm22hspBC9DW3wmKv58ZcIPLrTAI/PyBc9")); Assert.False(CryptPassword.Verify("Test", "$5$SALT$hRDk2PDSQpm22hspBC9DW3wmKv58ZcIPLrTAI/PyBc0")); }