Try the crypt() function with a text and a salt
This tool runs PHP's crypt() function on a text and a salt of your choice, and shows the result. With a two-character salt you get the traditional Unix DES hash: a 13-character string, the format of old .htpasswd files and early Unix systems.
Its main use is to reproduce or check an existing hash: migrating a legacy site, verifying a .htpasswd line, testing a script. Despite the word "encrypt", the result cannot be decrypted: it is a one-way hash. The MD5 encrypt page is one-way too, with a 32-character hash.
How to use it
- Enter the text in the first box.
- Type the salt in the Salt field, for example two letters.
- Click Encrypt.
- The result appears. The Copy button puts it on your clipboard.
Both fields are required: if either is empty, the tool shows an error. The computation runs on our server. Need a test password? The password generator makes one in a click.
What an example shows
| Text | Salt | Result |
|---|---|---|
password | ab | abJnggxhB/yWI |
password1 | ab | abJnggxhB/yWI |
password | xy | xyAjYtmfRYx/. |
The table tells you three things. The result starts with the salt: that is how a program finds it again when checking a password. Changing the salt changes everything after it, so two users with the same password do not share the same hash. And the first two rows are identical: in this format, only the first 8 characters of the text count. To judge the password itself, run it through the password strength checker.
The salt for this format accepts unaccented letters, digits, the dot and the slash. If you type more than two characters, only the first two are used. A one-character salt, or one containing a character that is not allowed, returns *0, the function's failure code.
Frequently asked questions
Can this format still protect passwords?
No. Eight useful characters and a two-character salt are cracked quickly on current hardware. Keep this format for compatibility with existing systems and use bcrypt or Argon2 for anything new.
How do I use the result in a .htpasswd file?
Each line reads user:hash, for example alice:abJnggxhB/yWI. Recent servers still accept this format but recommend stronger ones.
Why does the same text give different results?
Because the salt changed. With the same text and the same salt, the result is always the same.
What happens with a salt that starts with a dollar sign?
The crypt() function recognises prefixes such as $1$, $6$ or $2y$, which select other algorithms (MD5, SHA-512, bcrypt) when the salt follows their format exactly. The tool does not guide you through this: a malformed salt returns *0.