Some things . . . |
||
![]() Cpt SAJChurchey Just a few minor details here and there. Some refactoring. Do you know anything about JUnit tests? Someobody will have to write a test for this to be included. Just FYI. package net.cyberarmy.sneak.scheme;
import net.cyberarmy.sneak.Scheme;
import java.security.MessageDigest;
public class MD5Scheme implements Scheme{
public String getNameKey() {
return "scheme.MD5.name";
}
public String getDescriptionKey() {
return "scheme.MD5.description";
}
/**
* Creates an MD5 digest of the input string
* @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.
return new String(md.digest(input.getBytes()));
}
}
Cpt SAJChurchey
C/O of Editorial OSI Staff edit0r OSI Feedback Representative Replies:
|
||
| CyberArmy::Forum v0.6 Generated In 0.02334 seconds |