Save SHA Message : SHA Secure Hash Algorithm « Security « Java Tutorial






import java.io.FileOutputStream;
import java.io.ObjectOutputStream;
import java.security.MessageDigest;

public class MainClass {
  public static void main(String args[]) throws Exception {
    FileOutputStream fos = new FileOutputStream("test");
    MessageDigest md = MessageDigest.getInstance("SHA");
    ObjectOutputStream oos = new ObjectOutputStream(fos);
    String data = "thee";
    byte buf[] = data.getBytes();
    md.update(buf);
    oos.writeObject(data);
    oos.writeObject(md.digest());
  }
}








36.43.SHA Secure Hash Algorithm
36.43.1.Save SHA Message
36.43.2.SHA MessageDigest
36.43.3.Receive Self Mac
36.43.4.An alternate SHA Interleave algorithm as implemented in the SRP distribution