All Projects → spaze → Hashes

spaze / Hashes

Magic hashes – PHP hash "collisions"

Projects that are alternatives of or similar to Hashes

hash-wasm
Lightning fast hash functions using hand-tuned WebAssembly binaries
Stars: ✭ 382 (+37.41%)
Mutual labels:  md5, bcrypt, sha1
BruteForce
A simple brute forcer written in GO for SHA1, SHA256, SHA512, MD5 and bcrypt
Stars: ✭ 49 (-82.37%)
Mutual labels:  md5, bcrypt, sha1
Wjcryptlib
Public Domain C Library of Cryptographic functions. Including: MD5, SHA1, SHA256, SHA512, RC4, AES, AES-CTR, AES-OFB, AES-CBC
Stars: ✭ 250 (-10.07%)
Mutual labels:  md5, sha1
crypto.js
base on crypto module
Stars: ✭ 13 (-95.32%)
Mutual labels:  md5, sha1
angular-crypto
angular-crypto provides standard and secure cryptographic algorithms for Angular.js with support for: MD5, SHA-1, SHA-256, RC4, Rabbit, AES, DES, PBKDF2, HMAC, OFB, CFB, CTR, CBC, Base64
Stars: ✭ 30 (-89.21%)
Mutual labels:  md5, sha1
Gtkhash
A cross-platform desktop utility for computing message digests or checksums
Stars: ✭ 167 (-39.93%)
Mutual labels:  md5, sha1
Encrypt Body Spring Boot Starter
(停止维护,替代品搜索:https://github.com/search?l=Java&q=encrypt&type=Repositories )SpringBoot控制器统一的响应体加密与请求体解密的注解处理方式,支持MD5/SHA/AES/DES/RSA
Stars: ✭ 198 (-28.78%)
Mutual labels:  md5, sha1
fhash
fHash - an open source files hash calculator for Windows and macOS
Stars: ✭ 222 (-20.14%)
Mutual labels:  md5, sha1
Blooddy crypto
ActionScript (AS3) library for processing binary data. This library contains MD5, SHA-1, SHA-2 ( SHA-224 и SHA-256 ), Base64, CRC32 algorithms, JSON encoder & decoder as well as PNG and JPEG encoders.
Stars: ✭ 83 (-70.14%)
Mutual labels:  md5, sha1
Hashrat
Hashing tool supporting md5,sha1,sha256,sha512,whirlpool,jh and hmac versions of these. Includes recursive file hashing and other features.
Stars: ✭ 46 (-83.45%)
Mutual labels:  md5, sha1
hmac.nim
HMAC-SHA1 and HMAC-MD5 hashing in Nim
Stars: ✭ 13 (-95.32%)
Mutual labels:  md5, sha1
Merkle
Node.js module implementing Merkle tree algorithm
Stars: ✭ 123 (-55.76%)
Mutual labels:  md5, sha1
Hash Library
Portable C++ hashing library
Stars: ✭ 109 (-60.79%)
Mutual labels:  md5, sha1
Rufus
The Reliable USB Formatting Utility
Stars: ✭ 16,917 (+5985.25%)
Mutual labels:  md5, sha1
Hashcobra
HashCobra Hash Cracking tool.
Stars: ✭ 96 (-65.47%)
Mutual labels:  md5, sha1
ReSign
A burp extender that recalculate signature value automatically after you modified request parameter value.
Stars: ✭ 52 (-81.29%)
Mutual labels:  md5, sha1
Pwcrack Framework
Password Crack Framework
Stars: ✭ 72 (-74.1%)
Mutual labels:  md5, sha1
Pure lua sha
SHA1, SHA2 and SHA3 functions written in pure Lua and optimized for speed
Stars: ✭ 78 (-71.94%)
Mutual labels:  md5, sha1
hash-checker
Fast and simple application that allows you to generate and compare hashes from files and text
Stars: ✭ 72 (-74.1%)
Mutual labels:  md5, sha1
hediye
Hash Generator & Cracker
Stars: ✭ 40 (-85.61%)
Mutual labels:  md5, sha1

Magic hashes – PHP hash "collisions"

Register with password 1 and then sign in with password 2. If you're in then the storage uses specified algorithm to hash the password and PHP uses == to compare them (for MD5, SHA-1, and plaintext).

MD5, SHA-1, SHA-224, SHA-256 and others

For MD5, SHA-1 and SHA-2 family, it uses the long-known trick (it actually is a documented feature, see PHP type comparison tables & Floating point numbers) that for PHP '0e1' == '00e2' == '0', it just uses it for practical purposes. Any password matches any other password from the list. This is a different trick than integral strings overflowing into floating point numbers, just spot the difference between these two lines.

These are all the algorithms with magic hashes:

To quote @0xb0bb, "there are other applications for magic hashes other than password comparisons (such as caching layers or data derived from the output of a hash function) where these known insecure, lesser known and pseudo-hash algorithms can be found more readily."

Plaintext

For plaintext, it uses various conversion tricks. First password will match just the second one. Tricks are grouped by PHP versions allowing them.

bcrypt

bcrypt truncates passwords to a maximum length of 72 characters. The passwords match if the first 72 characters of both passwords match.

descrypt

descrypt (traditional UNIX DES crypt) truncates passwords to a maximum length of 8 characters. The passwords also match if the first 8 characters of both passwords match, see the "General cross-check" section.

PBKDF2-HMAC-SHA1, PBKDF2-HMAC-SHA224, PBKDF2-HMAC-SHA256

If you use a password longer than 64 bytes and hash it with PBKDF2-HMAC-SHA1, it is first pre-hashed with SHA1, so PBKDF2-HMAC-SHA1(password1) === PBKDF2-HMAC-SHA1(password2) because sha1(password1) === bin2hex(password2). The similar pre-hashing is applied in case of PBKDF2-HMAC-SHA224 and PBKDF2-HMAC-SHA256.

Tiger/192,3

Right now there's just one magic hash in each thanks to Norbert Tihanyi, more will be hopefully added in the future.

Conclusion

Use === when comparing anything* in PHP, not ==. And use password_hash() and password_verify() for password hashing in PHP, don't use MD5 or SHA-1. *Use hash_equals() when comparing hashes.

History

It all started with this tweet, I've generated QNKCDZO and 240610708 in February 2014 and it has since spread all over the intertubes. Just google it.

How to calculate your own

I've used my laptop, few for (or foreach?) loops, many CPU cycles and an external fan back in 2014 but today you can/should use a GPU and a modified hashcat for that. See this write-up by Carl Löndahl and 0xb0bb.

Chick3nman & co. is also working on their version of hashcat, stay tuned.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].