https://github.com/zorchenhimer/go-ed2k
ed2k hash implementation written in Go
https://github.com/zorchenhimer/go-ed2k
ed2k hash hashing hashing-algorithm
Last synced: 5 months ago
JSON representation
ed2k hash implementation written in Go
- Host: GitHub
- URL: https://github.com/zorchenhimer/go-ed2k
- Owner: zorchenhimer
- License: mit
- Created: 2022-10-23T23:12:54.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2022-12-17T18:04:30.000Z (over 3 years ago)
- Last Synced: 2024-06-20T11:15:50.318Z (about 2 years ago)
- Topics: ed2k, hash, hashing, hashing-algorithm
- Language: Go
- Homepage:
- Size: 9.77 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: license.md
Awesome Lists containing this project
README
# ED2K
This package implements the ed2k hashing algorithm. There are two different
implementations that are mostly the same but differ on an edge case. Both of
these are provided by this package.
## The Hash
A hash is calculated by first reading the input in 9728000 byte chunks. Each
chunk is then hashed with the MD4 algorithm. Once all chunks have been hashed,
the list of hashes for each chunk is hashed one more time, giving the final
hash.
If there is less than 9728000 bytes of data to hash, the MD4 of the data is
returned without further modification.
The two implementations differ when there are is a multiple of 9728000 bytes in
every chunk of the data. The Red version will add a zero-length chunk to the
end and add the hash of this empty chunk to the list of hashes before computing
the final hash. The Blue version does not do this.
The Sum() function uses the Blue method.