MessageDigest with SHA-1
import java.security.MessageDigest;
import java.security.Security;
public class MainClass {
public static void main(String args[]) throws Exception {
Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());
MessageDigest sha = MessageDigest.getInstance("SHA-1");
byte[] data1 = {65,66,67,68,69};
sha.update(data1);
byte[] msgDigest = sha.digest();
System.out.println("--- Message Digest ---");
for(int i=0; i<msgDigest.length; i++) {
System.out.print(msgDigest[i] + " ");
}
}
}
MessageDigestSHA-1.zip( 1,198 k)Related examples in the same category