HARD KEEL
Guide

Replacing MD5, SHA-1, DES, ECB and RSA-1024: what to use instead

Long before quantum computers matter, some encryption in your code is already weak. These are the ones that still turn up, and what to replace each with.

Hard Keel · November 20, 2026

At a glance

FoundProblemUse instead
MD5, SHA-1Collisions can be produced in practiceSHA-256 or SHA-3. For passwords, Argon2id, scrypt or bcrypt
DES, 3DES, RC4Broken or retiredAES-256-GCM or ChaCha20-Poly1305
ECB modeIdentical input blocks give identical output, so patterns leakAES-GCM with a fresh nonce for each message
RSA-1024Below today's minimum3072-bit keys now, then a post-quantum method
TLS 1.0, 1.1Deprecated by the IETF in 2021TLS 1.2 minimum, TLS 1.3 preferred

MD5 and SHA-1

Both are broken for anything an attacker can influence: signatures, certificates, integrity checks on uploaded files, and deduplication of untrusted data. Use SHA-256 or SHA-3.

Passwords are a separate case. Don't use any fast hash for them, SHA-256 included. Use a password hashing function: Argon2id, scrypt or bcrypt.

A checksum that only guards against accidental corruption, like a cache key, is fine. In Python, say so explicitly, so tools and readers can tell the difference:

hashlib.md5(data, usedforsecurity=False)

DES, 3DES and RC4

DES keys are short enough to brute-force. NIST disallowed 3DES for encryption after 2023, and RC4 is banned from TLS. Replace all three with an authenticated cipher, which both encrypts and detects tampering: AES-256-GCM, or ChaCha20-Poly1305 on hardware without AES acceleration.

ECB mode

ECB encrypts each block on its own, so the same input always gives the same output. Patterns in the data show through the encryption. It also turns up by accident: in Java, Cipher.getInstance("AES") with no mode means ECB with the default provider.

Use AES-GCM instead. Use a new random 12-byte nonce for every message, and never reuse a nonce with the same key.

Python (cryptography)

import os
from cryptography.hazmat.primitives.ciphers.aead import AESGCM

key = AESGCM.generate_key(bit_length=256)
nonce = os.urandom(12)
ciphertext = AESGCM(key).encrypt(nonce, plaintext, None)

JavaScript (Node.js)

const key = crypto.randomBytes(32);
const iv = crypto.randomBytes(12);
const cipher = crypto.createCipheriv('aes-256-gcm', key, iv);
const ciphertext = Buffer.concat([cipher.update(plaintext), cipher.final()]);
const tag = cipher.getAuthTag(); // store with the ciphertext and iv

Go

block, err := aes.NewCipher(key) // 32-byte key
if err != nil { return err }
gcm, err := cipher.NewGCM(block)
if err != nil { return err }
nonce := make([]byte, gcm.NonceSize())
if _, err := rand.Read(nonce); err != nil { return err }
ciphertext := gcm.Seal(nil, nonce, plaintext, nil)

Java

byte[] iv = new byte[12];
new SecureRandom().nextBytes(iv);
Cipher c = Cipher.getInstance("AES/GCM/NoPadding");
c.init(Cipher.ENCRYPT_MODE, key, new GCMParameterSpec(128, iv));
byte[] ciphertext = c.doFinal(plaintext);

RSA-1024 and other short keys

NIST's minimum for RSA has been 2048 bits since 2014. For new keys, use 3072 bits. But don't stop there: under NIST's final transition plan, RSA of every size is deprecated after 2030. A key you create today should come with a plan to move to ML-KEM or ML-DSA. More on the timeline.

TLS 1.0 and 1.1

RFC 8996 deprecated both in 2021, and current browsers refuse them. Set TLS 1.2 as the minimum and prefer 1.3. In Go, that's MinVersion: tls.VersionTLS12. In nginx, ssl_protocols TLSv1.2 TLSv1.3;.

Catch them before they merge

Most of these arrive through copied snippets and old examples, not deliberate choices. A check on each pull request catches them while the change is still small, and before they spread to the next service.

Keep the inventory current on every pull request

Hard Keel Quantum Scan is free. It flags leaked keys, weak encryption and encryption quantum computers will break in each pull request, and keeps a migration plan for the repository.

See how it works

Sources