Base64 and MD5 - Java

Asked

Viewed 751 times

0

What are the differences between MD5 and Base64 for encryption? Which is the safest?

I read that the MD5 is the most used, but I wanted to understand the reason.

  • Md5 is hash only, base 64 is a type of encoding

  • Can you give me an example of MD5 and Base64 usage situations?

  • 1

    Base 64 is not an encryption mechanism, it’s an encoding scheme. It is easily reversed, so it is not a good option to protect critical data. The common approach to passwords is to hash them with something like MD5 and then store the hash. When the user logs in again, enter the input password and compare it to the stored hash. The Base 64 encoding is generally used to transmit binary data through a mechanism that only allows ASCII text. Translated answer from here

  • 1

    Got it, Denis. !

  • 1

    @Denisrudneidesouza Please consider turning your comment into a response. Even if you consider something small and simple, it’s better for future visitors and then William can choose his answer for sure. Hugs!

  • Related: "What is the difference between coding, encryption and hash calculation?" About MD5 being used more, in the past it was considered safe, but it hasn’t been for a long time, however many developers around the world have not realized it yet - so it remains popular despite the insecurity. For more details, see "How to hash passwords securely?"

Show 1 more comment

1 answer

0


Base 64 is not an encryption mechanism, it’s an encoding scheme. It is easily reversed, so it is not a good option to protect critical data.

Base 64 encoding is generally used to transmit binary data through a mechanism that only allows ASCII text.

Formerly the common approach for passwords was to hash them with something like MD5 and then store the hash in the database. When the user logs in again, the password is entered, the hash is recalculated and checked with the existing one in the database.

You can check in that question, what is the best way to hash passwords safely today, since MD5 is no longer suitable for this purpose.

Source: https://stackoverflow.com/a/3993958/5325043

  • 1

    Good response except for the MD5 part. Never use MD5 for password protection, the answer that served as the basis for this answer is quite outdated (it was originally answered in 2010), and in its current version already points out that the MD5 is unsuitable for this purpose (although your suggestion to use SHA-1 is also not currently acceptable). For more details, see the question "How to hash passwords securely?"

Browser other questions tagged

You are not signed in. Login or sign up in order to post.