Base64 for Information Encryption and base64 for encryption
Base64 is the simplest and simplest form of encryption. It is often used and recorded for further understanding.
Jdk format:
// Obtain the key
Base64Encoder encoder = new Base64Encoder ();
// Encrypted String encoder_jdk = encoder. encode (src. getBytes (); System. out. println ("encoder:" + encoder );
// Decrypt
Byte [] decode_jdk = encoder. decode (encoder_jdk); System. out. print (decode_jdk );
CommonsCodes format:
Using commonsCodesBase64 encryption requires adding a jar package: commons-codec-1.10.jar
Public static void commonsCodesBase64 () {// encrypt byte [] encode_cc = org. apache. commons. codec. binary. base64.encodeBase64 (src. getBytes (); System. out. println ("encode:" + encode_cc); // decrypt byte [] decode_cc = org. apache. commons. codec. binary. base64.decodeBase64 (encode_cc); System. out. println ("decode:" + new String (decode_cc ));}
BouncyCastle format:
Using bouncyCastleBase64 encryption requires adding a jar package: bcprov-jdk15on-149.jar
Public static void bouncyCastleBase64 () {// encrypted byte [] encode_bc = org. bouncycastle. util. encoders. base64.encode (src. getBytes (); System. out. println ("encode:" + encode_bc); // decrypt byte [] decode_bc = org. bouncycastle. util. encoders. base64.decode (encode_bc); System. out. println ("decode:" + new String (decode_bc ));}
The conclusion is very simple and there is no technical content. I am very interested in information security. I would be very grateful if anyone could kindly advise me! (Mailbox: 1453296946@qq.com)