https://github.com/nicolasff/sha1-erlang
SHA-1 in Erlang
https://github.com/nicolasff/sha1-erlang
Last synced: 9 months ago
JSON representation
SHA-1 in Erlang
- Host: GitHub
- URL: https://github.com/nicolasff/sha1-erlang
- Owner: nicolasff
- Created: 2010-02-19T22:51:29.000Z (over 16 years ago)
- Default Branch: master
- Last Pushed: 2010-02-19T23:38:22.000Z (over 16 years ago)
- Last Synced: 2025-01-31T10:36:04.924Z (over 1 year ago)
- Language: Erlang
- Homepage:
- Size: 72.3 KB
- Stars: 8
- Watchers: 6
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
sha1.erl
=====================
This algorithm was ported from the book *Cryptography: Theory and Practice*, by Douglas Stinson.
Two functions are exported, `sha1:binstring/1` and `sha1:hexstring/1`. These functions take a data string in input and output either a binary or a string of uppercase hexadecimal values:
1> sha1:binstring("test").
<<169,74,143,229,204,177,155,166,28,76,8,115,211,
145,233,135,152,47,187,211>>
2> sha1:hexstring("test").
"A94A8FE5CCB19BA61C4C0873D391E987982FBBD3"
The library features two functions to hash files, but they are very slow. Also be aware that although SHA-1 outputs 160 bits, an attack exists using 2^63 operations "only".