This Package contains a single class Encryption.java which is used to encrypt string passed to the encrypt function defined in it
Package net.devmanuals.utils
This Package contains a single class Encryption.java which is used to encrypt string passed to the encrypt function defined in it. We use this class to encrypt the password of users. The encrypted password will be stored in the MySQL database table with the help of this class.
The structure of the net.devmanuals.utils package and code of each class with description is given below :
Encryption.java
package net.devmanuals.utils; import java.math.*; import java.security.*; public class Encryption { public static String encrypt(String source) { String md5 = null; try { MessageDigest mdEnc = MessageDigest.getInstance("MD5"); // Encryption // algorithm mdEnc.update(source.getBytes(), 0, source.length()); md5 = new BigInteger(1, mdEnc.digest()).toString(16); // Encrypted // string } catch (Exception ex) { return null; } return md5; } }
[ 0 ] Comments