New answers tagged

3

No. Hashing is not reversible. What is usually referred to as "cracking a hash" is to throw lots and lots of strings on the hash function and comparing the output with the list of hashes (a.k.a. "brute force").


2

If the password is in a dictionary (such as rockyou.txt) or is easily guessable, then tools like hashcat or john the ripper may be able to crack the hashed password using brute force.


0

For PKBDF2-HMAC-SHA256 on my Intel NUC i3 from 2018 I was getting 200000 iteration calculated roughly in 20ms and 400000 iters in 40ms. On my Mac M1 2021 results were about 10% slower. Here are more details and test script in Ruby and Crystal: https://lukas.zapletalovi.com/2021/05/finding-the-right-cost-for-bcryptpbkdf2.html


0

Build a simple calibration function that will calculate how much it takes to calculate X iterations, run it during app startup if that's feasible and set iteration count accordingly but not smaller than X (minimum count - a safe margin). This works really well for on-premise web applications where you can set the target execution time to be 30 or 50ms. This ...


1

A hash is an algorithm that computes a mostly-evenly distributed, fixed-sized output from a variably-sized input. A digest is the output of the hash function, which is a series of bytes. Bytes cannot be displayed or used in text interface, but they can be encoded into text. Base64 is one such text encoding of bytes into ASCII characters. In particular, the ...


1

Is it unsafe to display unencoded? The problem is not safety, at least in the way you're asking. The problem is the actual result of a hashing algorithm is binary. Md5 produces 128 bits (16 bytes) of data, but these are not ascii (or even Unicode) bytes. If treated as text, the result is very likely to include characters that are not printable, and ...


4

While the other answers contain plenty of good information, I think they missed the original point. This is a URL shortener. So Length is a critical factor. An MD5 hash gives you 128 1's and 0's. Naively using those 1's and 0's in your url makes it unnecessarily long. Encoding those 1's and 0's with base 64 considerably shortens the number of characters ...


13

What you see as the MD5 hash is the hex encoded version of it. The hash itself is binary, but we usually don't like to see binary data on screen. Another way to display the hash is using Base64, so all chars are printable. Encrypted strings are binary too, so you will want to encode them as base64 too. Or if you want a vintage encoding, try uuencode.


43

Hash functions output binary data, usually as a byte array. This cannot be displayed correctly, therefore, you need encoding. Transmitting binary data can create problems, especially in protocols that are designed to deal with textual data. To avoid it altogether, we don't transmit binary data. Many of the programming errors related to encryption on Stack ...


1

But how do I know which hash (of all the other hashes in the database) to compare to the user input? Each user has a row in your database with entries for columns: (1) username; (2) bcrypt output. Also, if bcrypt could check if it matches without a salt, couldn't anyone do that? bcrypt can not check without the salt. However, how do I know which salt to ...


61

The hash and salt are both in the value column. After Base64 decoding, the first 32 bytes are the hash, and the rest is the salt (in your case, it's the ASCII string seldemer).


0

To run hashcat on a common VPS without GPU (For example AWS) docker run --rm -it dizcza/docker-hashcat:intel-cpu \ hashcat -a 3 -m 1710 -w 4 --status --status-timer 10 \ 6ce9a7c73ebf0c04db026fda907210e7367f6d72225f78399a4a3fc9bfd0cce9:a3424259-9534-486a-bfe9-6a2b39aa70e5 \ "[[[Your dictionary file or hcmask pattern here]]]" brief explanation: -a 3 ...


0

It is not common practice to vary the hashing algorithm. Common advice is to use a standard hashing function, such as PBKDF2, bcrypt, scrypt, or Argon2. I have encountered several web applications that use non-standard hashing methods. This is usually the result of upgrading the hashing function. When a web application switches from MD5 hashing to PBKDF2 ...


6

Password hashing, like most cryptographic operations, is something you should never try creating from scratch, and should avoid even implementing from somebody else's design unless there's some reason you can't use a well-tested library. The obvious flaw in your scheme is that SHA256 is a fast hash, which means it's possible to attempt to brute-force it at a ...


4

The problem is that you would need to justify the extra design, and subsequent processing costs, against the benefits. Then compare that to simply using established, strong, hashing processes. And, as you say, all that extra effort and cost remain while the benefit evaporates once someone knows the procedure you use. Instead, what people do is design strong ...


3

Most common hash algorithms are designed to produce outputs that are indistinguishable from random, and as a result, even related inputs are not supposed to produce related outputs. Therefore, generating multiple hashes with related input isn't intrinsically insecure. You can use KMAC (related to SHA-3) and BLAKE2b as MACs and they can be used securely ...


2

That second part of the salt you are talking about actually has its own name - it's called a pepper. And as long as the real salt itself is always unique for each password, adding a pepper doesn't decrease security in any way (it arguably increases it in some scenarios). Regarding the length of the salt, 16 random bytes* each will be more than enough. Since ...


Top 50 recent answers are included