RSA/DSA/EC/OpenSSH Private Keys ($4$) Hash

Technical details, regex signatures, and cracking commands for the RSA/DSA/EC/OpenSSH Private Keys ($4$) algorithm.

Regex Identification Signature:
^\$sshng\$4\$16\$[0-9]{32}\$1232\$[a-f0-9]{2464}$
Hashcat Command (Mode: 22941):
Not supported natively by John the Ripper
← Back to Hash Identifier

What is RSA/DSA/EC/OpenSSH Private Keys ($4$)?

The cryptographic hash format "$4$" in OpenSSH private keys (commonly associated with RSA, DSA, and EC algorithms) originates from the legacy Unix crypt(3) password hashing scheme, adapted for key file encryption rather than password storage. Structurally, this format employs a **DES-based cipher** (specifically, the "MD5-based crypt" variant, though historically tied to older DES implementations) to encrypt the private key material, where the salt is embedded within the ciphertext itself in the format `$4$salt$hashedkey`. The primary use-case for this format was backward compatibility with older OpenSSH versions (pre-2006) and systems where stronger encryption (e.g., AES) was unavailable or undesirable. The key is encrypted symmetrically using a derived key from the passphrase via a fixed iteration count (typically 1000 by default), and the salt is prepended to the ciphertext to mitigate rainbow table attacks. However, this scheme is now obsolete in modern OpenSSH due to its known vulnerabilities and poor security properties.

The "$4$" format is vulnerable to cracking due to its reliance on **weak cryptographic primitives** and **predictable iteration counts**. The underlying DES-like cipher (even in MD5-based form) is susceptible to brute-force attacks when combined with short salts or weak passphrases, as modern GPUs and FPGA clusters can evaluate millions of hashes per second. The absence of a **salted iteration count** (unlike modern schemes like bcrypt or Argon2) allows attackers to precompute hashes offline, and the fixed iteration count (often 1000) is trivial to optimize with hardware acceleration. Additionally, the format lacks **key stretching**—modern implementations pad the iteration count dynamically based on system performance, but "$4$" uses a static value, making it vulnerable to timing attacks and parallel decryption. Collision resistance is further compromised by the MD5-based hashing, which is no longer considered secure for password hashing, and the ciphertext structure does not support forward secrecy or post-quantum resilience.

Identifying RSA/DSA/EC/OpenSSH Private Keys ($4$) Hashes

Identifying a hash blindly is often difficult because multiple algorithms can output strings of the exact same length. For example, a standard 32-character hexadecimal string could be MD5, NTLM, MD4, or LM. To definitively identify RSA/DSA/EC/OpenSSH Private Keys ($4$), security researchers analyze the hash against a strict regular expression (regex) signature (shown above) to find structural matches.

How to Crack RSA/DSA/EC/OpenSSH Private Keys ($4$)

If you need to recover the plaintext password for a RSA/DSA/EC/OpenSSH Private Keys ($4$) hash during a penetration test or forensics investigation, you must supply the correct module ID to your cracking software. Use the exact commands provided at the top of this page to target the hash successfully.