@@ -34,7 +34,7 @@ use thiserror::Error;
34
34
// output length.
35
35
const ARGON2_ALGORITHM : argon2:: Algorithm = argon2:: Algorithm :: Argon2id ;
36
36
pub const ARGON2_COST_M_KIB : u32 = 96 * 1024 ;
37
- pub const ARGON2_COST_T : u32 = 13 ;
37
+ pub const ARGON2_COST_T : u32 = 23 ;
38
38
pub const ARGON2_COST_P : u32 = 1 ;
39
39
40
40
// Maximum password length, intended to prevent denial of service attacks. See
@@ -589,62 +589,66 @@ mod test {
589
589
parse_phc_hash( "dummy" ) . unwrap_err( ) ,
590
590
"password hash: password hash string missing field"
591
591
) ;
592
- // This input was generated from argon2.online using the empty string as
593
- // input.
592
+ // This input was generated via `cargo run --example argon2 -- --input ""`.
594
593
let _ = parse_phc_hash (
595
- "$argon2id$v=19$m=98304,t=13,p=1$MDEyMzQ1Njc4OTAxMjM0NQ\
596
- $tFRlFMnzazQduuAkXOEi6k9g88nwBbUV8rJI0PjT8/I",
594
+ "$argon2id$v=19$m=98304,t=23,\
595
+ p=1$E4DE+f6Yduuy0nSubo5qtg$57JDYGov3SZoEZnLyZZBHOACH95s\
596
+ 8aOpG22zBoWZ2S4",
597
597
)
598
598
. unwrap ( ) ;
599
599
600
600
// The following inputs were constructed by taking the valid hash above
601
601
// and adjusting the string by hand.
602
602
assert_eq ! (
603
603
parse_phc_hash(
604
- "$argon2i$v=19$m=98304,t=13,p=1$MDEyMzQ1Njc4OTAxMjM0NQ\
605
- $tFRlFMnzazQduuAkXOEi6k9g88nwBbUV8rJI0PjT8/I"
604
+ "$argon2i$v=19$m=98304,t=23,\
605
+ p=1$E4DE+f6Yduuy0nSubo5qtg$57JDYGov3SZoEZnLyZZBHOACH95s\
606
+ 8aOpG22zBoWZ2S4",
606
607
)
607
608
. unwrap_err( ) ,
608
609
"password hash: algorithm: expected argon2id, found argon2i"
609
610
) ;
610
611
assert_eq ! (
611
612
parse_phc_hash(
612
- "$argon2id$v=19$m=98304,t=13 ,p=1$\
613
- $tFRlFMnzazQduuAkXOEi6k9g88nwBbUV8rJI0PjT8/I"
613
+ "$argon2id$v=19$m=98304,t=23 ,p=1$\
614
+ $57JDYGov3SZoEZnLyZZBHOACH95s8aOpG22zBoWZ2S4" ,
614
615
)
615
616
. unwrap_err( ) ,
616
617
// sic
617
618
"password hash: salt invalid: value to short" ,
618
619
) ;
619
620
assert_eq ! (
620
621
parse_phc_hash(
621
- "$argon2id$v=19$m=98304,t=13 ,p=1$MDEyMzQ1Njc \
622
- $tFRlFMnzazQduuAkXOEi6k9g88nwBbUV8rJI0PjT8/I"
622
+ "$argon2id$v=19$m=98304,t=23 ,p=1$E4DE+f6Ydu$ \
623
+ 57JDYGov3SZoEZnLyZZBHOACH95s8aOpG22zBoWZ2S4" ,
623
624
)
624
625
. unwrap_err( ) ,
625
626
"password hash: salt: expected at least 16 bytes" ,
626
627
) ;
627
628
assert_eq ! (
628
629
parse_phc_hash(
629
- "$argon2id$v=19$m=4096,t=13,p=1$MDEyMzQ1Njc4OTAxMjM0NQ\
630
- $tFRlFMnzazQduuAkXOEi6k9g88nwBbUV8rJI0PjT8/I"
630
+ "$argon2id$v=19$m=4096,t=23,\
631
+ p=1$E4DE+f6Yduuy0nSubo5qtg$57JDYGov3SZoEZnLyZZBHOACH95s\
632
+ 8aOpG22zBoWZ2S4",
631
633
)
632
634
. unwrap_err( ) ,
633
635
"password hash: parameter 'm': expected at least 98304 (KiB), \
634
636
found 4096"
635
637
) ;
636
638
assert_eq ! (
637
639
parse_phc_hash(
638
- "$argon2id$v=19$m=98304,t=12,p=1$MDEyMzQ1Njc4OTAxMjM0NQ\
639
- $tFRlFMnzazQduuAkXOEi6k9g88nwBbUV8rJI0PjT8/I"
640
+ "$argon2id$v=19$m=98304,t=22,\
641
+ p=1$E4DE+f6Yduuy0nSubo5qtg$57JDYGov3SZoEZnLyZZBHOACH95s\
642
+ 8aOpG22zBoWZ2S4",
640
643
)
641
644
. unwrap_err( ) ,
642
- "password hash: parameter 't': expected at least 13 , found 12 "
645
+ "password hash: parameter 't': expected at least 23 , found 22 "
643
646
) ;
644
647
assert_eq ! (
645
648
parse_phc_hash(
646
- "$argon2id$v=19$m=98304,t=13,p=0$MDEyMzQ1Njc4OTAxMjM0NQ\
647
- $tFRlFMnzazQduuAkXOEi6k9g88nwBbUV8rJI0PjT8/I"
649
+ "$argon2id$v=19$m=98304,t=23,\
650
+ p=0$E4DE+f6Yduuy0nSubo5qtg$57JDYGov3SZoEZnLyZZBHOACH95s\
651
+ 8aOpG22zBoWZ2S4",
648
652
)
649
653
. unwrap_err( ) ,
650
654
// sic
0 commit comments