Overview
This node provides various bcryptjs operations for password hashing and verification. It is useful in scenarios where you need to securely hash passwords, generate salts, verify passwords against hashes, or extract information from existing bcrypt hashes. Typical use cases include user authentication systems, password management workflows, and security auditing.
For example:
- Generating a salt value before hashing a password.
- Hashing a password with a specified salt or number of rounds.
- Comparing a plaintext password with a stored hash to verify credentials.
- Extracting the number of rounds or salt used in an existing hash.
Properties
| Name | Meaning |
|---|---|
| Rounds | The cost factor for processing data; higher values increase computation time. Default: 10. |
| Minor Version | The minor version of bcrypt to use when generating salt. Options: "A", "B". |
| Options | Collection of additional options: - Output Field Name: The field name where the result will be saved (default: "result"). |
Note: The "Rounds" property applies to both "Generate Salt" and "Hash Password" operations. The "Minor Version" property applies only to "Generate Salt".
Output
The node outputs JSON data containing the original input fields plus one additional field holding the operation result. The name of this output field can be customized via the "Output Field Name" option (default is result).
Depending on the operation, the output field contains:
- For Generate Salt: A string representing the generated salt.
- For Hash Password: A string representing the hashed password.
- For Compare Password: A boolean indicating if the password matches the hash.
- For Get Rounds: A number indicating the rounds used in the hash.
- For Get Salt: A string containing the salt extracted from the hash.
- For Test Truncation: A boolean indicating if the password will be truncated.
The node does not output binary data.
Dependencies
- Requires the
bcryptjslibrary bundled within the node. - No external API keys or services are needed.
- No special environment variables or n8n configurations are required.
Troubleshooting
Common issues:
- Providing invalid or malformed hash strings may cause errors when extracting rounds or salt.
- Using non-numeric or out-of-range values for rounds can lead to unexpected behavior or errors.
- Forgetting to provide a password or hash parameter for relevant operations will cause failures.
Error messages:
"Unknown operation: <operation>": Indicates an unsupported operation was selected. Verify the operation name."Bcryptjs <operation> operation failed: <message>": General failure during bcryptjs processing. Check input parameters for correctness.
Resolutions:
- Ensure all required inputs (password, hash, rounds) are correctly set.
- Use valid bcrypt hash formats.
- Use numeric values for rounds where applicable.
- Customize the output field name carefully to avoid overwriting important data.