How to find MD5, SHA1, SHA256 and SHA512 Checksums Of String

Published July 05, 2024

md5 checksum

MD5 checksum is a hash function. It is not considered secure, but is still in use for file authentication and other things. If you want to know how to find the MD5 checksum of a file or text, this blog post is for you.

What is MD5 checksum?

MD5 checksum is a message-digest algorithm. It is a cryptographic hash function that takes an input of any length and converts it to 128 bits. This is a one-way function, meaning it is transformed to the hash value, but there is no function to do the opposite. MD5 hash is represented by a fixed string of 32 hexadecimal letters. Each hexadecimal digit contains digits from 0-9 or letters A-F.

This is an example of an MD5 checksum:

20b7b6fb9523c8124730b385819a4982

The above MD5 was calculated for the string Arul John.

MD5 always returns a hash value output of 128 bits or 32 hexadecimal characters.

What is SHA hashing?

SHA stands for Secure Hash Algorithm. They are a family of cryptographic hash functions and include SHA-1, SHA-256, SHA-224 and SHA-512, and SHA-384. Similar to MD5, they produce hashes which are one-way, and it is technically not possible to transform them back to the original string. With these stronger encryption, it is harder for hackers to succeed in their attacks.

SHA are used mainly for encrypting passwords. Here, the server stores only the hashed values and not the original strings (usually the password).

Here is a quick summary on the SHA hash length for each of the SHA hashes.

  • SHA-1 returns a hash value output of 160 bits or 40 hexadecimal characters.
  • SHA-256 returns a hash value output of 256 bits or 64 hexadecimal characters.
  • SHA-512 returns a hash value output of 512 bits or 128 hexadecimal characters.
  • SHA-384 returns a hash value output of 384 bits or 96 hexadecimal characters.
  • SHA-224 returns a hash value output of 224 bits or 56 hexadecimal characters.

How do I find MD5 checksum of a string online?

Just use our online MD5 hash generator.

How to find MD5 checksum of a string from the command line

On most flavors of Linux or on the Mac, you should have the md5sum tool installed.

We will try to find the MD5 checksum of the string Arul John.

This is the easiest and most accurate command:

echo -n "Arul John" | md5sum

Output:

20b7b6fb9523c8124730b385819a4982

Why can't I just run: echo "Arul John" | md5sum ?

When you run echo "Arul John" and pipe it to md5sum, you are also sending the trailing newline \n into md5sum. So, you get the MD5 for the wrong string Arul John\n instead of Arul John.

Using echo -n sends only Arul John and skips the \n.

Another way to find MD5 checksum of a string

There are more ways to find the MD5 checksum of the string Arul John.

Type this on the command line and press ENTER

md5sum  -

Then, type Arul John and press Ctrl+D. You will see the MD5 checksum immediately beside the string Arul John.

Arul John20b7b6fb9523c8124730b385819a4982  -

The result is 20b7b6fb9523c8124730b385819a4982.

Find the MD5 checksum of string using printf

This command uses printf to print the correct MD5 checksum value as well:

printf "%s" "Arul John" | md5sum

Output:

20b7b6fb9523c8124730b385819a4982

Find the MD5 checksum of string using openssl

This command uses openssl to print the correct MD5 checksum.

echo -n "Arul John" | openssl md5

Output:

20b7b6fb9523c8124730b385819a4982

Find the MD5 checksum of string and store in a variable called md5str

You enclose the command with $( ) and extract the first 32 characters like this:

md5hash=$(echo -n "Arul John" | md5sum | head -c 32)
echo $md5hash

Output:

20b7b6fb9523c8124730b385819a4982

How do I find SHA1, SHA256, SHA512 checksum of a string online?

Just use our online hash generator.

How can I find the SHA1 hash of a string on the terminal?

You can run the same command above, but pipe it to sha1sum instead of md5sum.

$ echo -n Arul John | sha1sum 
82adbb3469cc1ea03d45faa652811c938b917618  -

How can I find the SHA256 hash of a string?

You can run the same command above, but pipe it to sha256sum instead of md5sum.

$ echo -n Arul John | sha256sum 
26872c9ff8746e5979fb511d99f0f710b22bc658950aaa91a5ead468f6b8e633  -

How can I find the SHA512 hash of a string?

You can run the same command above, but pipe it to sha512sum instead of md5sum.

$ echo -n Arul John | sha512sum 
110384208bc07ff7676f25ef98c33d639c756b413198777de18e7b73ebe5a0ae8af305828c130bd4781614eb0359110c1aff74c4c3fcf7f23947d835527d4ea0  -

How can I find the SHA384 hash of a string?

You can run the same command above, but pipe it to sha384sum instead of md5sum.

$ echo -n Arul John | sha384sum 
f56e6efdf83a68bfe34e2ba979893f1d23200a95118e44605ba233b50018e99375f0675583c9c25d8260d8c70e77d6b8  -

How can I find the SHA224 hash of a string?

You can run the same command above, but pipe it to sha224sum instead of md5sum.

$ echo -n Arul John | sha224sum 
b710c8f31c7f4375e5041f61a27607b7c8da2cae56f3c3c7e2ab30f6  -

Conclusion

This is just a limited number of ways you can find the MD5 value. You can also generate MD5 checksum from within Python, PHP, Ruby and pretty much every programming language.

Related Posts

If you have any questions, please contact me at arulbOsutkNiqlzziyties@gNqmaizl.bkcom. You can also post questions in our Facebook group. Thank you.

Disclaimer: Our website is supported by our users. We sometimes earn affiliate links when you click through the affiliate links on our website.

Last Updated: July 05, 2024.     This post was originally written on July 04, 2024.