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

Support for sha2 (sha256 / sha512 hashes) #23

Closed
matthijs opened this issue Dec 23, 2016 · 2 comments
Closed

Support for sha2 (sha256 / sha512 hashes) #23

matthijs opened this issue Dec 23, 2016 · 2 comments

Comments

@matthijs
Copy link

Hi,

Is it possible to support sha2 ? (sha256 / sha512 hashes)

We are using hashes that are usually generated by the openssl library, an example of generating such a digest:

std::string password = "somepassword";

// generate a SHA512 hash using the openssl library
char buf[SHA512_DIGEST_LENGTH];
SHA512_CTX ctx;
if (!SHA512_Init(&ctx)) {
    std::cerr << "failed to initialize." << std::endl;
}
if (!SHA512_Update(&ctx, password.c_str(), password.length())) {
    std::cerr << "failed to update sha context." << std::endl;
}
if (!SHA512_Final((unsigned char *)buf, &ctx)) {
    std::cerr << "failed to get the hash." << std::endl;
}

It's not a complete example, but it gives an head start hopefully.

Regards, Matthijs

@NigelCunningham
Copy link
Owner

Yes, it's possible. I'll add support once I get the refactoring I'm currently doing bedded down.

@NigelCunningham
Copy link
Owner

Committed just now. Enjoy!

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

No branches or pull requests

2 participants