MainClass.java Source code

Java tutorial

Introduction

Here is the source code for MainClass.java

Source

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] + " ");
        }
    }
}