Reputation: 31
I want to perform SHA256 hashing in a Blackberry application. Searching, I found the Bouncy Castle project has a crypto library for this, but I can't find any samples to show how to use SHA256 hashing.
Upvotes: 2
Views: 5409
Reputation: 11876
BlackBerry has built-in implementations of nearly everything in the BouncyCastle API. For SHA256, there is SHA256Digest.
Upvotes: 0
Reputation: 1238
Just reposting user598312's answer as a response instead of a comment, so people know the solution.
private static byte[] getSHA512(String key) {
SHA512Digest digester = new SHA512Digest();
byte[] retValue = new byte[digester.getDigestSize()];
digester.update(key.getBytes(), 0, key.length());
digester.doFinal(retValue, 0);
return retValue;
}
Upvotes: 2