File tree 3 files changed +14
-0
lines changed
3 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -91,6 +91,10 @@ pub const Params = struct {
91
91
/// Baseline parameters for offline usage using argon2id type
92
92
pub const sensitive_2id = Self .fromLimits (4 , 1073741824 );
93
93
94
+ /// Recommended parameters for argon2id type according to the
95
+ /// [OWASP cheat sheet](https://cheatsheetseries.owasp.org/cheatsheets/Password_Storage_Cheat_Sheet.html).
96
+ pub const owasp_2id = Self { .t = 2 , .m = 19 * 1024 , .p = 1 };
97
+
94
98
/// Create parameters from ops and mem limits, where mem_limit given in bytes
95
99
pub fn fromLimits (ops_limit : u32 , mem_limit : usize ) Self {
96
100
const m = mem_limit / 1024 ;
Original file line number Diff line number Diff line change @@ -408,8 +408,14 @@ pub const State = struct {
408
408
409
409
/// bcrypt parameters
410
410
pub const Params = struct {
411
+ const Self = @This ();
412
+
411
413
/// log2 of the number of rounds
412
414
rounds_log : u6 ,
415
+
416
+ /// Minimum recommended parameters according to the
417
+ /// [OWASP cheat sheet](https://cheatsheetseries.owasp.org/cheatsheets/Password_Storage_Cheat_Sheet.html).
418
+ pub const owasp = Self { .rounds_log = 10 };
413
419
};
414
420
415
421
/// Compute a hash of a password using 2^rounds_log rounds of the bcrypt key stretching function.
Original file line number Diff line number Diff line change @@ -141,6 +141,10 @@ pub const Params = struct {
141
141
/// Baseline parameters for offline usage
142
142
pub const sensitive = Self .fromLimits (33554432 , 1073741824 );
143
143
144
+ /// Recommended parameters according to the
145
+ /// [OWASP cheat sheet](https://cheatsheetseries.owasp.org/cheatsheets/Password_Storage_Cheat_Sheet.html).
146
+ pub const owasp = Self { .ln = 17 , .r = 8 , .p = 1 };
147
+
144
148
/// Create parameters from ops and mem limits, where mem_limit given in bytes
145
149
pub fn fromLimits (ops_limit : u64 , mem_limit : usize ) Self {
146
150
const ops = @max (32768 , ops_limit );
You can’t perform that action at this time.
0 commit comments