Cryptography
Encryption
TLS
AES
Argon2
+3 more

Encryption Best Practices 2026: TLS 1.3, AES-256, Argon2 & Post-Quantum Readiness

SCR Security Research Team
January 17, 2026
20 min read
Share

Modern Cryptography Standards (2026)

Use CaseRecommended AlgorithmKey SizeStatus
Data in transitTLS 1.3N/A (protocol)Current standard
Symmetric encryptionAES-256-GCM256-bitCurrent standard
Password hashingArgon2idN/A (hash)OWASP recommended
Digital signaturesEd25519 or ECDSA P-256256-bitCurrent standard
Key exchangeX25519255-bitCurrent standard
HashingSHA-256 or SHA-3256-bitCurrent standard
Post-quantum KEMML-KEM-768 (Kyber)768-bitNIST finalized 2024
Post-quantum signaturesML-DSA-65 (Dilithium)Level 3NIST finalized 2024

TLS 1.3 Configuration

What Changed in TLS 1.3

FeatureTLS 1.2TLS 1.3
Handshake2 round trips1 round trip (0-RTT available)
Cipher suites37+ options5 secure options only
Key exchangeRSA or ECDHEECDHE only (forward secrecy mandatory)
Removed featuresStatic RSA, RC4, SHA-1, CBC mode, compressionAll removed
0-RTT resumptionNot availableAvailable (with replay protections)

Nginx TLS 1.3 Configuration

server {
    listen 443 ssl http2;
    server_name securecodereviews.com;

    ssl_certificate /etc/letsencrypt/live/securecodereviews.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/securecodereviews.com/privkey.pem;

    # TLS 1.2 minimum (TLS 1.3 preferred)
    ssl_protocols TLSv1.2 TLSv1.3;

    # Cipher suites (TLS 1.3 uses its own, TLS 1.2 uses these)
    ssl_ciphers ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384;
    ssl_prefer_server_ciphers off;

    # HSTS (2 years with preload)
    add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload" always;

    # OCSP Stapling
    ssl_stapling on;
    ssl_stapling_verify on;
}

Data Encryption at Rest

AES-256-GCM (Authenticated Encryption)

import { createCipheriv, createDecipheriv, randomBytes } from "crypto";

// AES-256-GCM — Provides both encryption AND integrity verification
function encrypt(plaintext: string, key: Buffer): EncryptedData {
  const iv = randomBytes(12);  // 96-bit IV for GCM
  const cipher = createCipheriv("aes-256-gcm", key, iv);

  let ciphertext = cipher.update(plaintext, "utf8", "hex");
  ciphertext += cipher.final("hex");
  const authTag = cipher.getAuthTag();

  return {
    ciphertext,
    iv: iv.toString("hex"),
    authTag: authTag.toString("hex"),
  };
}

function decrypt(data: EncryptedData, key: Buffer): string {
  const decipher = createDecipheriv(
    "aes-256-gcm",
    key,
    Buffer.from(data.iv, "hex")
  );
  decipher.setAuthTag(Buffer.from(data.authTag, "hex"));

  let plaintext = decipher.update(data.ciphertext, "hex", "utf8");
  plaintext += decipher.final("utf8");
  return plaintext;
}

Critical Rules:

  • Never reuse an IV with the same key (GCM catastrophically fails)
  • Use authenticated encryption (GCM, ChaCha20-Poly1305) — not CBC
  • Store encryption keys in KMS (AWS KMS, Azure Key Vault), never in code

Password Hashing

import argon2 from "argon2";

// Hash password with Argon2id
async function hashPassword(password: string): Promise<string> {
  return argon2.hash(password, {
    type: argon2.argon2id,
    memoryCost: 65536,   // 64 MB
    timeCost: 3,          // 3 iterations
    parallelism: 4,       // 4 threads
  });
}

// Verify password
async function verifyPassword(password: string, hash: string): Promise<boolean> {
  return argon2.verify(hash, password);
}

Hashing Algorithm Comparison

AlgorithmStatusMemory HardnessGPU Resistance
MD5BROKEN — Never useNoNo
SHA-1BROKEN — Never useNoNo
SHA-256OK for hashing, NOT for passwordsNoNo
bcryptGood (legacy)Fixed (4KB)Moderate
scryptGoodConfigurableGood
Argon2idBestConfigurableExcellent

Post-Quantum Cryptography

Why Post-Quantum Matters Now

Quantum computers that can break RSA and ECC are estimated to arrive between 2030-2035. But:

  • Harvest Now, Decrypt Later: Adversaries are collecting encrypted data today to decrypt when quantum computers arrive
  • Migration takes years: Transitioning cryptographic infrastructure is a 3-5 year project
  • NIST finalized standards in 2024: ML-KEM and ML-DSA are production-ready

Recommended Post-Quantum Algorithms

PurposeAlgorithmNIST StandardStatus
Key EncapsulationML-KEM-768 (Kyber)FIPS 203Finalized 2024
Digital SignaturesML-DSA-65 (Dilithium)FIPS 204Finalized 2024
Hash-based SignaturesSLH-DSA (SPHINCS+)FIPS 205Finalized 2024

Hybrid TLS (Classical + Post-Quantum)

Chrome and Cloudflare already support hybrid key exchange using X25519 + ML-KEM-768, protecting against both classical and quantum attacks.


Common Cryptographic Mistakes

MistakeRiskFix
Rolling your own cryptoSubtle bugs = complete failureUse established libraries
ECB modePattern leakageUse GCM or CTR mode
Reusing IVs/noncesKey recovery in GCM, predictabilityGenerate random IV per encryption
Hardcoded keysKey exposure in source codeKMS or Vault
SHA-256 for passwordsNo brute-force protectionArgon2id or bcrypt
RSA-1024Breakable with current computingRSA-2048 minimum (RSA-4096 preferred)

Further Reading

Advertisement