Java - MD5 - First Draft |
||
![]() Maj anvar Ok, I found some time and decided to give MD5 a try, it does even give an output :), so feel free to comment. import java.security.MessageDigest;
public class MD5 {
public String getNameKey() {
return "scheme.MD5.name";
}
public String getDescriptionKey() {
return "scheme.MD5.description";
}
/**
* Default method to run this.
* @param input String -- The string we want to MD5.
* @return String -- The result we get.
*/
public String execute(String input) {
if (input == null) return null;
input = input.trim();
if (input.length() == 0) return null;
MessageDigest md = null;
try {
md = MessageDigest.getInstance("MD5");
}
// Eat the exception because it shouldn't happen.
catch (Exception e) {
return "Source-code Error";
}
// Input the text and return the MD5 into the result String.
String result = new String(md.digest(input.getBytes()));
return result;
}
}
It's not who you are that makes you do things, it's why you do things that determines who you are. Replies:
|
||
| CyberArmy::Forum v0.6 Generated In 0.02313 seconds |