I have java three strings. let say example.
String test = "Hi, ";
String test1 = "this is ";
String test2 = "Java programming!";
I wanna combine those 3 string and change it to md5 format. How could I do? I use MessageDigest class for one string but i have no idea how to append 3 string before change to md5. And I wanna to change back md5 to string. Do i need external library.
Well reversing MD5 is not really feasible as -
You would have seen lot of websites that provide reverse MD5 (as - Option-1 , option-2). These websites stores mapping of already used "String and MD5" (So if you use complex String they wont be able to deduce original one).
Moving back to Part - 1
MessageDigest can be used to calculate MD5 of a given String in Java. Its usage is fairly Simple -
String testString="someText";
MessageDigest md = MessageDigest.getInstance("MD5");
byte[] messageDigest = md.digest(testString.getBytes());
BigInteger number = new BigInteger(1, messageDigest);
String hashtext = number.toString(16);
So in your problem it depends how you want to create hash -
Way 1 - As you asked we can have -
StringBuilder simpleString=new StringBuilder(test);
simpleString.append(test1);
simpleString.append(test2);
String testString=simpleString.toString();
And finally call the method defined above with input as - testString.
Way 2 - I will suggest you to use MD5 of MD5 to have secured checksum.
Output = MD5(MD5(test)+MD5(test1)+MD5(test2))
You can try creating a brute-force attack on a string of 3 characters. Assuming only English letters (A-Z, a-z) and numbers (0-9) are allowed, there are "only" 623 (238,328) combinations in this case.
Hope it helps. :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With