@@ -34,7 +34,7 @@ use thiserror::Error;
3434// output length.
3535const ARGON2_ALGORITHM : argon2:: Algorithm = argon2:: Algorithm :: Argon2id ;
3636pub const ARGON2_COST_M_KIB : u32 = 96 * 1024 ;
37- pub const ARGON2_COST_T : u32 = 13 ;
37+ pub const ARGON2_COST_T : u32 = 23 ;
3838pub const ARGON2_COST_P : u32 = 1 ;
3939
4040// Maximum password length, intended to prevent denial of service attacks. See
@@ -589,62 +589,66 @@ mod test {
589589 parse_phc_hash( "dummy" ) . unwrap_err( ) ,
590590 "password hash: password hash string missing field"
591591 ) ;
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 ""`.
594593 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",
597597 )
598598 . unwrap ( ) ;
599599
600600 // The following inputs were constructed by taking the valid hash above
601601 // and adjusting the string by hand.
602602 assert_eq ! (
603603 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",
606607 )
607608 . unwrap_err( ) ,
608609 "password hash: algorithm: expected argon2id, found argon2i"
609610 ) ;
610611 assert_eq ! (
611612 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" ,
614615 )
615616 . unwrap_err( ) ,
616617 // sic
617618 "password hash: salt invalid: value to short" ,
618619 ) ;
619620 assert_eq ! (
620621 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" ,
623624 )
624625 . unwrap_err( ) ,
625626 "password hash: salt: expected at least 16 bytes" ,
626627 ) ;
627628 assert_eq ! (
628629 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",
631633 )
632634 . unwrap_err( ) ,
633635 "password hash: parameter 'm': expected at least 98304 (KiB), \
634636 found 4096"
635637 ) ;
636638 assert_eq ! (
637639 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",
640643 )
641644 . unwrap_err( ) ,
642- "password hash: parameter 't': expected at least 13 , found 12 "
645+ "password hash: parameter 't': expected at least 23 , found 22 "
643646 ) ;
644647 assert_eq ! (
645648 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",
648652 )
649653 . unwrap_err( ) ,
650654 // sic
0 commit comments