Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add functions MD5 SHA1 SHA1HMAC SHA256 SHA256HMAC #109

Merged
merged 6 commits into from
Nov 14, 2016
Merged

Conversation

slambour
Copy link
Contributor

Adds cryptographic hashes and hashmac.
The code of MD5 SHA1 & SHA256 is not factorized.
It could be with a generic function DIGEST with the Digest instance given in the constructor.
by ex : functions.put("SHA1", new DIGEST("SHA1", new SHA1Digest()));

@hbs
Copy link
Collaborator

hbs commented Nov 14, 2016

Can't you factor those functions already?

But don't create DIGEST with an instance of Digest, instead pass it a class and in 'apply' create a new instance, otherwise you would be sharing the same Digest instance between all current executions of the DIGEST functions.

so DIGEST(String name, Class<? extends GeneralDigest>)


return stack;
} catch (Exception exp) {
throw new WarpScriptException("Unable to instantiate digest " + getName());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you change the WarpScriptException to start with getName() so as to retain the overall structure.

throw new WarpScriptException(getName() + " unable to instantiate digest").

Same for HMAC.

@hbs hbs merged commit 9bf8942 into senx:master Nov 14, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants