fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.io.*;
  4. import java.security.MessageDigest;
  5. import java.security.NoSuchAlgorithmException;
  6. public class Test {
  7.  
  8. public static void main(String args[]) throws NoSuchAlgorithmException{
  9. String input="hello world";
  10. MessageDigest mDigest = MessageDigest.getInstance("SHA256");
  11. byte[] result = mDigest.digest(input.getBytes());
  12. for (int i = 0; i < result.length; i++) {
  13. sb.append(Integer.toString((result[i] & 0xff) + 0x100, 16).substring(1));}
  14. System.out.println(sb.toString());
  15.  
  16.  
  17.  
  18.  
  19. String Str = new String("hello world");
  20. System.out.println("Hashcode for Str :" + Str.hashCode() );
  21. }}
  22.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:6: error: class Test is public, should be declared in a file named Test.java
public class Test {
       ^
1 error
stdout
Standard output is empty