MessageDigest with SHA-1 : Message Digest « Security « Java






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

1.Create a checksum
2.Operations to simplifiy common java.security.MessageDigest tasks.
3.Digest string
4.MD4 Digest
5.MD5 Digest
6.Implements the MD4 message digest algorithm in Java
7.This program computes the message digest of a file or the contents of a text area.This program computes the message digest of a file or the contents of a text area.
8.Returns the type MessageDigest of the input text with the input salt.
9.Message Digest Util
10.A directive is a parameter of the digest authentication process