简体   繁体   中英

How to implement SHA 1 Algorithm in Java

i want to implement SHA 1 Algorithm using java. Can any one help me


Refer this

Not sure quite what you're asking; Wikipedia has pseudo-code: http://en.wikipedia.org/wiki/SHA-1 you should be able to code it up in java from that relativly easily... Did you have any specific question about doing it, or...?

I think you can just use java.security.MessageDigest . For ASCII data this is as simple as

String src = ...
MessageDigest md = MessageDigest.getInstance("SHA-1");
String sha1 = new String(md.digest(src.getBytes()));

Just don't do it, load the bouncycastle libraries and use them. Or look at their source, and then you know one way how to implement it :).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM