# SHA-1 Generator

Computes a digest from a string using SHA-1. Learn more about SHA-1 in the SHA-1 explained section of this page.

I use Bouncy Castle for the implementation.

## SHA-1 Explained

### What is SHA-1?

SHA-1 is a message-digest algorithm. It's used to compute a hash value in cryptography. So what's an hash function then? Simply put, a hash function takes a block of data and returns a fixed-size bit string (hash value). The data used by hash functions is referred to as a "message", while the computed hash value is referred to as the "message digest".

### When to use SHA-1?

SHA-1, like other hash functions, is used in digital signatures, message authentication codes, to index data in hash tables, for finger-printing, to detect duplicate data, uniquely identify files, and as checksums to detect accidental data corruption.

### How big is a SHA-1 hash value?

SHA-1 produces a 160-bit (20-byte) hash value. It's usually represented as a hexadecimal number of 40 digits.

### How can I decrypt SHA-1?

You can't! SHA-1 is NOT an encryption algorithm! A lot of people are under the impression that SHA-1 encrypts data. It does no such thing. All it does is compute a hash value for a given set of data.

### How do I reverse SHA-1?

You can't! SHA-1 is NOT reversible. Hash functions are used as one-way methods. They take the data (messages) and compute hash values (digests).
The inverse can't be done.

To better explain why a SHA-1 is NOT reversible, here's very simple example:

Using SHA-1 on text data of 750,000 characters, we obtain a mere 40 digits digest. Now if I wanted to revert this,
how could I possibly determine with exactitude which 750,000 characters were used from just 40 digits?!? This would be the BEST compression algorithm in the world :P