authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-08-31 11:59:51-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-09-01 17:54:07-07:00
log8d2acff197a46a9de33ce78713291428aa45ee7c
tree009e91f14db769398fdfebb5929a783d148af583
parent89dd2b7ac23f298b5ac37ae022724b43c2137091

disable slow scrypt tests


1 files changed, 27 insertions(+), 13 deletions(-)

lib/std/crypto/scrypt.zig+27-13
......@@ -523,7 +523,12 @@ pub fn strVerify(
523523 }
524524}
525525
526test "scrypt kdf" {
526// These tests take way too long to run, so I have disabled them.
527const run_long_tests = false;
528
529test "kdf" {
530 if (!run_long_tests) return error.SkipZigTest;
531
527532 const password = "testpass";
528533 const salt = "saltsalt";
529534
......@@ -537,7 +542,9 @@ test "scrypt kdf" {
537542 try std.testing.expectEqualSlices(u8, &bytes, &dk);
538543}
539544
540test "scrypt kdf rfc 1" {
545test "kdf rfc 1" {
546 if (!run_long_tests) return error.SkipZigTest;
547
541548 const password = "";
542549 const salt = "";
543550
......@@ -551,7 +558,9 @@ test "scrypt kdf rfc 1" {
551558 try std.testing.expectEqualSlices(u8, &bytes, &dk);
552559}
553560
554test "scrypt kdf rfc 2" {
561test "kdf rfc 2" {
562 if (!run_long_tests) return error.SkipZigTest;
563
555564 const password = "password";
556565 const salt = "NaCl";
557566
......@@ -565,7 +574,9 @@ test "scrypt kdf rfc 2" {
565574 try std.testing.expectEqualSlices(u8, &bytes, &dk);
566575}
567576
568test "scrypt kdf rfc 3" {
577test "kdf rfc 3" {
578 if (!run_long_tests) return error.SkipZigTest;
579
569580 const password = "pleaseletmein";
570581 const salt = "SodiumChloride";
571582
......@@ -579,11 +590,8 @@ test "scrypt kdf rfc 3" {
579590 try std.testing.expectEqualSlices(u8, &bytes, &dk);
580591}
581592
582test "scrypt kdf rfc 4" {
583 // skip slow test
584 if (true) {
585 return error.SkipZigTest;
586 }
593test "kdf rfc 4" {
594 if (!run_long_tests) return error.SkipZigTest;
587595
588596 const password = "pleaseletmein";
589597 const salt = "SodiumChloride";
......@@ -598,7 +606,9 @@ test "scrypt kdf rfc 4" {
598606 try std.testing.expectEqualSlices(u8, &bytes, &dk);
599607}
600608
601test "scrypt password hashing (crypt format)" {
609test "password hashing (crypt format)" {
610 if (!run_long_tests) return error.SkipZigTest;
611
602612 const str = "$7$A6....1....TrXs5Zk6s8sWHpQgWDIXTR8kUU3s6Jc3s.DtdS8M2i4$a4ik5hGDN7foMuHOW.cp.CtX01UyCeO0.JAG.AHPpx5";
603613 const password = "Y0!?iQa9M%5ekffW(`";
604614 try CryptFormatHasher.verify(std.testing.allocator, str, password);
......@@ -609,7 +619,9 @@ test "scrypt password hashing (crypt format)" {
609619 try CryptFormatHasher.verify(std.testing.allocator, str2, password);
610620}
611621
612test "scrypt strHash and strVerify" {
622test "strHash and strVerify" {
623 if (!run_long_tests) return error.SkipZigTest;
624
613625 const alloc = std.testing.allocator;
614626
615627 const password = "testpass";
......@@ -631,7 +643,9 @@ test "scrypt strHash and strVerify" {
631643 try strVerify(s1, password, verify_options);
632644}
633645
634test "scrypt unix-scrypt" {
646test "unix-scrypt" {
647 if (!run_long_tests) return error.SkipZigTest;
648
635649 const alloc = std.testing.allocator;
636650
637651 // https://gitlab.com/jas/scrypt-unix-crypt/blob/master/unix-scrypt.txt
......@@ -648,7 +662,7 @@ test "scrypt unix-scrypt" {
648662 }
649663}
650664
651test "scrypt crypt format" {
665test "crypt format" {
652666 const str = "$7$C6..../....SodiumChloride$kBGj9fHznVYFQMEn/qDCfrDevf9YDtcDdKvEqHJLV8D";
653667 const params = try crypt_format.deserialize(crypt_format.HashResult(32), str);
654668 var buf: [str.len]u8 = undefined;