Calculating SHA-1 in the Browser
Important: SHA-1 is considered weak, has been broken and should be avoided for cryptographic applications!
Calculating the SHA-1 hash of a string can be useful for different reasons. As noted above, you shouldn’t use it for cryptographic applications but it still can (and is) used for integrity and consistency. For example, git uses SHA-1 hashes for commits to ensure consistency. But it also comes in handy whenever you’re not really interested in the data itself but only need some way to check whether two entities have the same data. You can then just exchange the SHA-1 of the data (which is usually much shorter than the data itself) and check whether your copy is the same as the others.
Calculating the SHA-1 of a string is quite easy in most browsers — even IE11 provides the necessary APIs.