fork(1) download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import javax.xml.bind.DatatypeConverter;
  4. import java.math.BigInteger;
  5. import java.net.URLEncoder;
  6. import java.util.Base64;
  7. import java.io.UnsupportedEncodingException;
  8. import java.security.MessageDigest;
  9. import java.security.NoSuchAlgorithmException;
  10. import java.security.NoSuchProviderException;
  11. import java.util.Date;
  12. import java.util.Formatter;
  13.  
  14. /* Name of the class has to be "Main" only if the class is public. */
  15. class Ideone
  16. {
  17. public static void main (String[] args) throws java.lang.Exception
  18. {
  19. System.out.println(base64Encode(getHash("test"+getHash("test"))));
  20. }
  21. {
  22. byte[] bytes = MessageDigest.getInstance("SHA1").digest(text.getBytes("UTF-8"));
  23. return new String(bytes, "UTF-8");
  24. }
  25. private static String base64Encode(String text) throws Exception{
  26. byte[] encodedBytes = Base64.getEncoder().encode(text.getBytes("UTF-8"));
  27. return new String(encodedBytes);
  28. }
  29. }
Success #stdin #stdout 0.05s 711168KB
stdin
Standard input is empty
stdout
Ni3vv70pNzfvv70I77+977+977+9OTpZPu+/vUhz