ed2k
Ed2k
A pure crystal implementation of the ED2K and MD4 algorithms for file hashing.
MD4 was implemented with ED2K in mind, it was not intended to be used on its own!
Installation
-
Add the dependency to your
shard.yml
:dependencies: ed2k: git: https://codeberg.org/Sylphrena/Ed2k.cr.git
-
Run
shards install
Usage
require "ed2k"
# Using file path directly
Ed2k.hexdigest "path/to/file"
# Using IO
File.open "path/to/file", "r" do |io|
Ed2k.hexdigest io
end
Naturally, you can hash other objects as well, but this hash is almost exclusively used for files.
Development
This shard is relatively complete, but the MD4 module could be improved to match existing digest functionality in stdlib.
Contributing
- Fork it (https://codeberg.org/Sylphrena/Ed2k.cr)
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
Contributors
- Sylphrena - creator and maintainer