fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. String name = padRight("dafnehdr@gmail.com", 20);
  13. String id = padRight("5169867580", 20);
  14. StringBuilder out = new StringBuilder();
  15. for (int i = 0; i < 20; i++) {
  16. out.append((name.charAt(i) ^ id.charAt(i)) % 10);
  17. }
  18. byte[] rawDigest = out.toString().getBytes();
  19. String digest = md5sumToString(rawDigest);
  20. System.out.println(digest);
  21. }
  22.  
  23. private static String padRight(String up4Padding, int requiredSize) {
  24. return String.format("%1$-" + requiredSize + "s", up4Padding);
  25. }
  26.  
  27. public static String md5sumToString(byte[] digest) {
  28. StringBuilder result = new StringBuilder();
  29. for (byte it : digest) {
  30. result.append(Integer.toString((it & 0xff) + 0x100, 16).substring(1));
  31. }
  32. return result.toString();
  33. }
  34. }
Success #stdin #stdout 0.15s 57900KB
stdin
Standard input is empty
stdout
3130303733343331303737353336343739373030