@@ -0,0 +1,1008 @@
+package login;%0A%0Aimport java.io.UnsupportedEncodingException;%0Aimport java.security.MessageDigest;%0Aimport java.security.NoSuchAlgorithmException;%0A%0Apublic class PasswordHelper%0A%7B%0A%09public static String generatePasswordHash(String password)%0A%09%7B%0A%09%09//Create instances of digest and password char array%0A%09%09MessageDigest passDigest;%0A%09%09byte%5B%5D passArray;%0A%0A%09%09try%0A%09%09%7B%0A%09%09%09//Create instance of MessageDigest we can use to  %0A%09%09%09passDigest = MessageDigest.getInstance(%22MD5%22);%0A%0A%09%09%09//Convert password to byte array %0A%09%09%09passArray = password.getBytes(%22UTF-8%22);%0A%09%09%7D%0A%09%09catch (NoSuchAlgorithmException e)%0A%09%09%7B%0A%09%09%09//Hardcoded algorithm type, this exception shouldn't be called%0A%09%09%09e.printStackTrace();%0A%09%09%09return %22%22;%0A%09%09%7D%0A%09%09catch (UnsupportedEncodingException e)%0A%09%09%7B%0A%09%09%09//Hardcoded encoding type, this exception shouldn't be called%0A%09%09%09e.printStackTrace();%0A%09%09%09return %22%22;%0A%09%09%7D%0A%0A%09%09//Use digest to get an array of chars as a hash and return it as a string%0A%09%09byte%5B%5D hashArray = passDigest.digest(passArray);%0A%09%09return new String(hashArray);%0A%09%7D%0A%0A%7D%0A

Create PasswordHelper class in login module