@@ -13,6 +13,8 @@ use core::{
1313
1414/// `yescrypt` algorithm parameters.
1515///
16+ /// [`Params::default`] provides the recommended parameters.
17+ ///
1618/// These are various algorithm settings which can control e.g. the amount of resource utilization.
1719#[ derive( Clone , Copy , Debug , Eq , PartialEq ) ]
1820pub struct Params {
@@ -41,7 +43,7 @@ pub struct Params {
4143 /// `0` means no upgrades yet, and is currently the only allowed value.
4244 pub ( crate ) g : u32 ,
4345
44- /// special to yescrypt .
46+ /// Number of NROM blocks (128r bytes each) .
4547 pub ( crate ) nrom : u64 ,
4648}
4749
@@ -50,11 +52,21 @@ impl Params {
5052 pub ( crate ) const MAX_ENCODED_LEN : usize = 8 * 6 ;
5153
5254 /// Initialize params.
55+ ///
56+ /// Accepts the following arguments:
57+ /// - `mode`: most users will want [`Mode::default`]. See the [`Mode`] type for more info.
58+ /// - `n`: CPU/memory cost. See [`Params::n`] for more info.
59+ /// - `r`: resource usage. See [`Params::r`] for more info.
60+ /// - `p`: parallelization. See [`Params::p`] for more info.
5361 pub fn new ( mode : Mode , n : u64 , r : u32 , p : u32 ) -> Result < Params > {
5462 Self :: new_with_all_params ( mode, n, r, p, 0 , 0 )
5563 }
5664
57- /// Initialize params.
65+ /// Initialize params including additional `yescrypt`-specific settings.
66+ ///
67+ /// Accepts all the same arguments as [`Params::new`] with the following additional arguments:
68+ /// - `t`: increase computation time while keeping peak memory usage the same. `0` is optimal.
69+ /// - `g`: number of cost upgrades performed on the hash so far. `0` is the only allowed value.
5870 pub fn new_with_all_params (
5971 mode : Mode ,
6072 n : u64 ,
@@ -103,6 +115,9 @@ impl Params {
103115 }
104116
105117 /// `p` parameter: parallelization (like `scrypt`).
118+ ///
119+ /// Allows use of multithreaded parallelism (not currently implemented, `1` is the recommended
120+ /// setting for now).
106121 pub const fn p ( & self ) -> u32 {
107122 self . p
108123 }
0 commit comments