The scrypt password-based key derivation function with sync and cancellable async.
Overall
score
98%
Build a password key derivation utility that handles Unicode passwords correctly to ensure consistent key generation across different platforms and input methods.
Users may enter passwords using different input methods, keyboard layouts, or copy-paste from various sources. This can result in visually identical passwords that are actually represented differently at the byte level (e.g., composed vs decomposed Unicode characters). Your utility must normalize these inputs to ensure the same password always generates the same cryptographic key.
Create a module that derives cryptographic keys from passwords with proper Unicode handling:
The module should provide a synchronous function that takes a password string and salt string, normalizes them properly, and returns a hex-encoded derived key.
@generates
/**
* Derives a cryptographic key from a password using scrypt with proper Unicode normalization.
*
* @param {string} password - The password string (may contain Unicode characters)
* @param {string} salt - The salt string (may contain Unicode characters)
* @returns {string} The derived key as a hexadecimal string
*/
function deriveKey(password, salt) {
// IMPLEMENTATION HERE
}
module.exports = { deriveKey };Provides the scrypt password-based key derivation function.
@satisfied-by
Install with Tessl CLI
npx tessl i tessl/npm-scrypt-jsdocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10