Password Hash Generator

Generate random passwords and hash them using various algorithms

Overview

This node generates one or more random passwords and hashes them using a selected cryptographic algorithm. It is useful in scenarios where you need to create secure passwords programmatically, for example, when onboarding new users, generating API keys, or creating temporary credentials. The node supports multiple character sets for password generation and various hashing algorithms including bcrypt, SHA variants, and MD5.

Practical examples:

  • Generate 10 random passwords of length 16 with alphanumeric characters plus symbols, hashed with bcrypt for secure storage.
  • Create a single numeric password of length 8 hashed with SHA-256 for quick verification purposes.
  • Produce multiple letter-only passwords hashed with MD5 for legacy system compatibility.

Properties

Name Meaning
Number of Passwords How many passwords to generate (1 to 100).
Password Length Length of each generated password (4 to 128 characters).
Character Set Characters to use when generating passwords:
- Alphanumeric + Symbols
- Alphanumeric Only
- Letters Only
- Numbers Only
Hash Algorithm Hashing algorithm to use:
- Bcrypt
- MD5
- SHA-1
- SHA-256
- SHA-512
Salt Rounds (Bcrypt Only) Number of salt rounds for bcrypt hashing (4 to 15). Higher means more secure but slower.
Include Plain Text Whether to include the plain text password in the output (true/false).

Output

The node outputs an array of objects under the json field with the following structure:

  • passwords: An array of generated password objects, each containing:

    • index: The sequence number of the password starting at 1.
    • hash: The hashed password string according to the selected algorithm.
    • algorithm: The name of the hashing algorithm used.
    • plainText (optional): The original generated password in plain text if requested.
    • saltRounds (only for bcrypt): The number of salt rounds used in hashing.
  • totalGenerated: Total number of passwords generated.

  • algorithm: The hashing algorithm used for all passwords.

  • passwordLength: Length of each generated password.

  • characterSet: The character set used for password generation.

No binary data output is produced by this node.

Dependencies

  • Uses Node.js built-in crypto module for hashing algorithms except bcrypt.
  • Dynamically imports the bcrypt library only if bcrypt hashing is selected.
  • No external API keys or services are required.
  • Requires the bcrypt package to be installed in the n8n environment for bcrypt support.

Troubleshooting

  • Common issues:

    • If bcrypt is selected but the bcrypt package is not installed or accessible, the node will fail to hash passwords.
    • Providing invalid values outside the allowed ranges for password count, length, or salt rounds may cause errors.
    • Selecting unsupported or misspelled character sets or hash algorithms will default to safe options but should be avoided.
  • Error messages:

    • Errors related to missing bcrypt module: Install the bcrypt package in your n8n environment.
    • Validation errors on input parameters: Ensure numbers are within specified min/max limits.
    • Runtime errors during hashing: Check that inputs conform to expected types and values.

Links and References

Discussion