Miserlou / omnihash

Hash files, strings, input streams and network resources in various common algorithms simultaneously
https://github.com/Miserlou/omnihash
MIT License
252 stars 23 forks source link

Support Algos plugins & pluginize sha3/pyblake3 to allow running on Windows. #9

Closed ankostis closed 8 years ago

ankostis commented 8 years ago

I wanted to use the nice project also on Windows a live example when giving presentations about signing etc. But I didn't manage to find sha3 or pyblake2 "native" libraries pre-compiled (searched in Gohlke's famous site, Anaconda, WinPython). So I converted these dependencies into setuptools plugin mechanism.

Now in linux you have to install it with:

pip install omnihash[*]

while under Windows:

pip install omnihash

NOTE: to run tests, the project may have to be installed in "develop" mode:

pip uninstall omnihash -y; pip install -e .
Miserlou commented 8 years ago

An alternative to this to seriously consider is simply using pure python hash algorithms. This would actually enable more algos, because https://pypi.python.org/pypi/pysha3 looks like it's a great implementation with more algos that the one I used originally. Also https://github.com/buggywhip/blake2_py

The flips side is that there would be an obvious performance hit though.

ankostis commented 8 years ago

That would be even better. Supporting swapable implementations of algorithms is exactly what this small PR is for. And then, having a "filtering" mechanism for selecting which algos to print becomes even more urgent (#10).

Miserlou commented 8 years ago

Is there anyway to have the default be to include all of the available plugins so nix users don't have to include the [*]?

ankostis commented 8 years ago

Is there anyway to have the default be to include all of the available plugins so nix users don't have to include the [*]?

Not any that I know of, sorry :-(

At least the tool provides the python-platform,'s algos out-of-the-box; and if more algos implemented (#4, #1, bitcoin(?)) then using plugins would be part of the mentality of the users.

I have intentionally left CRCs without plugins, although they are a different library. You may try to pluginize them yourself, just to get the feeling of effort required. It is 3 to 5 lines LoC to modify, setuptools fo a really good job for ganlding plugins and their dependencies.