Miklix

SHA-1 Hash Code Calculator

Published: February 10, 2025 at 4:26:48 PM UTC

Hash code calculator that uses the Secure Hash Algorithm 1 (SHA-1) hash function to calculate a hash code based on text input or file upload.

The SHA-1 (Secure Hash Algorithm 1) is a cryptographic hash function designed by the NSA and published by the NIST in 1995. It produces a 160 bit (20 byte) hash value, commonly represented as a 40-character hexadecimal string. SHA-1 was widely used for securing data integrity, digital signatures, and certificates, but it's now considered insecure due to vulnerabilities to collision attacks. It's included here in case one needs to calculate a hash code that must be compatible with an older system, but it should not be used when designing new systems.

Full disclosure: I did not write the specific implementation of the hash function used on this page. It is a standard function included with the PHP programming language. I only made the web interface to make it publicly available here for convenience.


Calculate New Hash Code

Data submitted or files uploaded through this form will only be kept on the server for as long as it takes to generate the requested hash code. It will be deleted immediately before the result is returned to your browser.

Input data:



Submitted text is UTF-8 encoded. Since hash functions operate on binary data, the result will be different than if the text was in another encoding. If you need to calculate a hash of a text in a specific encoding, you should upload a file instead.



About the SHA-1 Hash Algorithm

I'm not a mathematician, so I'll try to explain this hash function in a way that other non-mathematicians can understand - if you want the exact scientific math version of the explanation, you can find that on plenty of other websites ;-)

Think of SHA-1 like a special paper shredder that takes any message - whether it's one word, a sentence, or an entire book - and shreds it in a very specific way. But instead of just shredding, it magically spits out a unique "shred code" that is always exactly 40 hexadecimal characters long.

  • For example, you put in "Hello"
  • You get out 40 hexadecimal digits like f7ff9e8b7bb2e09b70935a5d785e0cc5d9d0abf0

No matter what you feed it - short or long - the output is always the same length.

The "magical shredder" works in four steps:

Step 1: Prepare the Paper (Padding)

  • Before shredding, you need to prepare your paper. Imagine adding blank spaces to the end of your message so it fits perfectly into the shredder's tray.
  • It's like when you bake cookies, and you make sure the dough fills the mold evenly.

Step 2: Chop It into Equal Pieces (Splitting)

  • The shredder doesn't like big chunks. So, it chops your prepared message into smaller, equal-sized pieces - like cutting a big cake into perfect slices.

Step 3: The Secret Recipe (Mixing and Mashing)

  • Now comes the cool part! Inside the shredder, each piece of your message goes through a series of mixers and rollers:
    • Mixing: It stirs your message with some secret ingredients (built-in rules and numbers).
    • Mashing: It squishes, flips, and spins the parts around in a special way.
    • Twisting: Some parts are twisted or reversed, like folding paper into origami.

Each step makes the message more jumbled, but in a very specific way that the machine always follows.

Step 4: The Final Code (Hash)

  • After all the mixing and mashing, out comes a neat, scrambled code - like a unique fingerprint for your message.
  • Even if you change just one letter in your original message, the output will be completely different. That’s what makes it special.

The reason SHA-1 shouldn't be used anymore is that some very smart people figured out how to trick the shredder into making the same code for two different messages (this is called a collision).

Instead of SHA-1, we now have stronger, smarter "shredders". At the time of writing, my default go-to hash algorithm for most purposes is SHA-256 - and yes, I do have a calculator for that as well: SHA-256 Hash Code Calculator

Share on BlueskyShare on FacebookShare on LinkedInShare on TumblrShare on XShare on LinkedInPin on Pinterest

Mikkel Bang Christensen

About the Author

Mikkel Bang Christensen
Mikkel is the creator and owner of miklix.com. He has over 20 years experience as a professional computer programmer/software developer and is currently employed full-time for a large European IT corporation. When not blogging, he spends his spare time on a vast array of interests, hobbies, and activities, which may to some extent be reflected in the variety of topics covered on this website.