Skip to content

Algorithms

The Crypto module supports various cryptographic algorithms for hashing and encryption.

Hash Algorithms

AlgorithmNotes
md5Fast but insecure for password hashing.
sha1Legacy, widely used but considered weak.
sha256Recommended for most use cases.
sha512High security 512-bit hash

Password Hash Algorithms

AlgorithmNotes
argon2idModern, resistant to GPU cracking. Recommended.
bcryptIndustry standard, robust and slow.
scryptMemory-hard algorithm.

Authenticated Encryption (Secretbox)

AlgorithmModeNotes
xsalsa20-poly1305AuthenticatedHigh-speed, high-security standard.

Cipher Algorithms

AlgorithmModeNotes
aes-256-cbcCBCStandard block cipher mode.
aes-256-gcmGCMAuthenticated encryption, recommended.
aes-256-ctrCTRStream cipher mode.

Use cases

  • sha256 – Standard hashing for checksums and signatures.
  • aes-256-gcm – Secure encryption with built-in integrity checking.