iotaledger/iota-java

Make HashFactory wrapper

kwek20 opened this issue · 4 comments

The name SpongeFactory is (although correct) a little ambigue for non-cryptographic users.

We should make a wrapper around this factory that returns the correct SpongeFactory instances according to https://github.com/iotaledger/kerl/blob/master/README.md

This can be an enum or a factory with a switch.

Is this still relevant? Currently the class SpongeFactory has a static factory method create where the user can pass the hashing mode.

Or would you like something HashFactory.createKerl()?

This was by your request!
"But why is it called SpongeFactory in the code and not HashingFunction? 🤔"
We agreed on keeping the old code but making another class/factory/enum which is easier to understand. Keeping the old one for compatibility and uniformity with IRI

Ah ok, I thought this one declined. In my opinion it’s better we document it well and leave the new HashingFunction class. If we introduce them we have duplicate code, everytime we have to adjust two classes. If it’s ok for you then I would document that the spongefactory represents the hashing method. And after this we can close this one here.

@ManuZiD This is fine by me as well! Im not a fan of having both either, but if it decreased the learning curve it would still be a win in my opinion.

lets do the documenting though, changes are few people need to use it without having knowledge of iota