The basic thing to follow while handling the sensitive information like password and credit card number, is to keep them encrypted everywhere in the program.
So here are some methods which gives proper encryption and decryption methods.
public static String encrypt(String msg) {
String ns = "2131232132132324234";
String es = "2132123213321321341241";
BigInteger n = new BigInteger(ns);
BigInteger e = new BigInteger(es);
BigInteger bi = new BigInteger(msg.getBytes());
BigInteger x = bi.modPow(e, n);
return (x.toString());
}
Do you really need a decryption method? I guess you may not. You can use the same for the reverse also. If still unclear, ask me...
This entry was posted
on Jun 18, 2008
at Wednesday, June 18, 2008
and is filed under
encryption
. You can follow any responses to this entry through the
comments feed
.