Thorin Oakenshield
Thorin Oakenshield

Reputation: 14662

How to implement SHA 1 Algorithm in Java

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


Refer this

Upvotes: 0

Views: 5294

Answers (3)

scarba05
scarba05

Reputation: 3001

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()));

Upvotes: 1

Daniel
Daniel

Reputation: 28074

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 :).

Upvotes: 0

Tara
Tara

Reputation: 615

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...?

Upvotes: 2

Related Questions