Hi all

I'm not sure is this the right place to post this, other places are strongly oriented to the real programming. However...

I know some MD5 hashes contains only numbers or letters, but I don't know which one. Some string X gives only letters in the hash, Y gives only numbers.

Do you know which strings give those hashes?

Dani AI

Generated

Clarification and practical plan for 's question: MD5 produces a 128‑bit result normally shown as a 32‑character hexadecimal string using characters 0–9 and a–f. "Only numbers" means every hex digit is one of 0–9; "only letters" means every hex digit is one of a–f. The phenomenon is just a rare outcome of the hash output, not a special property of particular input types.

As noted, the event is uncommon but not impossible, so brute force is the simple, reliable route. The search should try candidate inputs, compute MD5, and test whether the hex digest falls entirely in the digit set or entirely in the letter set. Note 's post: inputs that produce a match can be arbitrary byte sequences (including non‑printable bytes), so restrict the search deliberately (printable strings, numeric-only inputs, or raw byte sequences) to keep it tractable.

Example brute‑force scaffold (Python, standard library):

import hashlib, itertools

DIGITS = set('0123456789')
LETTERS = set('abcdef')

def kind(h):                    # h must be lowercase hexdigest()
    if set(h) <= DIGITS: return 'digits'
    if set(h) <= LETTERS: return 'letters'
    return None

charset = '0123456789abcdefghijklmnopqrstuvwxyz'  # narrow to start
max_len = 5

for L in range(1, max_len + 1):
    for tup in itertools.product(charset, repeat=L):
        data = ''.join(tup).encode('utf-8')
        h = hashlib.md5(data).hexdigest()
        k = kind(h)
        if k:
            print(k, L, data, h)
            raise SystemExit

Practical tips: begin with tiny lengths and a very small charset, then broaden. For large searches use dedicated GPU tools (hashcat/John) or distributed work; enumerating full byte ranges grows exponentially and becomes infeasible quickly. Also remember hexdigests are case-consistent (use .lower()), and that MD5 is cryptographically broken for security uses — suitable here only for curiosity or non‑security experiments.

Recommended Answers

All 3 Replies

No.

By the way, wtf is up with the advertisement in this thread?

"Trying to Encrypt Your DB with MD5? ******* already does it. Try now!"

WTF.

Edit: But you can surely find one.

Since you're talking about a hash that outputs 32 characters (in hexadecimal, which presumably is what you're talking about), each character has a 5/8 chance of being a decimal digit and a 3/8 chance of being a letter.

That means there's a (5/8)^32 chance of them all being decimal digits.

Which means it will take on average 1/(5/8)^32 guesses to get such a hash, which is easily small enough for a computer to brute force.

Finding a hash with just letters is about 8 million times harder than that.

commented: Good explanation that hex contains both decimal digits and letters (A-F). +5

Well, 3,5 million guesses isn't so much.

How should I brute force that?

This byte sequence (in hex) resulted in an MD5 hash of 68 96 55 13 90 19 02 12 35 06 45 31 90 73 51 46

A4 03 56 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.