You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 13, 2025. It is now read-only.
// Iterations should ideally be as high as possible.
101
+
// OWASP recommends 310.000 iterations for PBKDF2 with SHA-256 [https://cheatsheetseries.owasp.org/cheatsheets/Password_Storage_Cheat_Sheet.html#pbkdf2].
102
+
// The problem that we have here is that this is run inside the browser
103
+
// and we must use the JavaScript implementation which is slow.
104
+
// There is the SubtleCrypto API in browsers that is implemented in native code inside the browser and can use cryptographic CPU extensions.
105
+
// However SubtleCrypto is only available in secure contexts (https) so we cannot use it
106
+
// because nodecg-io should be usable on e.g. raspberry pi on a local trusted network.
107
+
// So were left with only 5000 iterations which were determined
108
+
// by checking how many iterations are possible on a AMD Ryzen 5 1600 in a single second
109
+
// which should be acceptable time for logging in. Slower CPUs will take longer,
110
+
// so I didn't want to increase this any further.
111
+
112
+
// For comparison: the crypto.js internal key generation function that was used in nodecg.io <0.3 configs
113
+
// used PBKDF1 based on a single MD5 iteration (yes, that is really the default in crypto.js...).
114
+
// So this is still a big improvement in comparison to the old config format.
99
115
iterations: 5000,
116
+
// Use SHA-256 as the hashing algorithm. crypto.js defaults to SHA-1 which is less secure.
0 commit comments