// Path: encryption/src/main/java/com/zhangjikai/encrypt/Encryption.java
// public class Encryption {
// 
// 
//     public static String base64Encode(String original) {
//         String encyStr = "";
//         try {
//             byte[] bytes = original.getBytes("UTF-8");
//             encyStr = Base64.getEncoder().encodeToString(bytes);
//         } catch (UnsupportedEncodingException e) {
//             e.printStackTrace();
//             encyStr = "";
//         }
//         return encyStr;
//         //String enStr =
//     }
// 
//     public static String base64Decode(String encyStr) {
//         String original = "";
//         byte[] bytes = Base64.getDecoder().decode(encyStr);
//         original = new String(bytes);
//         return original;
//     }
// 
//     public static String MD5(String original) {
//         String encyStr = "";
//         try {
//             MessageDigest md5 = MessageDigest.getInstance("MD5");
//             byte[] bytes = original.getBytes("UTF-8");
//             md5.update(bytes);
//             BigInteger integer = new BigInteger(md5.digest());
//             encyStr = integer.toString(16);
//         } catch (NoSuchAlgorithmException e) {
//             e.printStackTrace();
//         } catch (UnsupportedEncodingException e) {
//             e.printStackTrace();
//         }
//         return encyStr;
//     }
// }


import com.zhangjikai.encrypt.Encryption;
import org.junit.Test;

/**
 * Created by ZhangJikai on 2016/10/26.
 */
public class TestEncryption {

    @Test
     public void testBase64() {
        String s = "\n" +
                "\n" +
                "                                                Sulfate-(O-6)+\n" +
                "                                                             |\n" +
                " Sulfate-(O-6)-a-D-Glcp2Me3Me4Me-(1-4)-b-D-GlcpA2Me3Me-(1-4)+|                  Sulfate-(O-6)+\n" +
                "                                                            ||                               |\n" +
                "                                                        a-D-Glcp-(1-4)-a-L-IdopA2Me3Me-(1-4)+|\n" +
                "                                                            ||                              ||\n" +
                "                                               Sulfate-(O-3)+|                          a-D-Glcp-(1-1)-methyl\n" +
                "                                                             |                              ||\n" +
                "                                                Sulfate-(O-2)+                 Sulfate-(O-3)+|\n" +
                "                                                                                             |\n" +
                "                                                                                Sulfate-(O-2)+\n";

// Path: encryption/src/main/java/com/zhangjikai/encrypt/Encryption.java
// public class Encryption {
// 
// 
//     public static String base64Encode(String original) {
//         String encyStr = "";
//         try {
//             byte[] bytes = original.getBytes("UTF-8");
//             encyStr = Base64.getEncoder().encodeToString(bytes);
//         } catch (UnsupportedEncodingException e) {
//             e.printStackTrace();
//             encyStr = "";
//         }
//         return encyStr;
//         //String enStr =
//     }
// 
//     public static String base64Decode(String encyStr) {
//         String original = "";
//         byte[] bytes = Base64.getDecoder().decode(encyStr);
//         original = new String(bytes);
//         return original;
//     }
// 
//     public static String MD5(String original) {
//         String encyStr = "";
//         try {
//             MessageDigest md5 = MessageDigest.getInstance("MD5");
//             byte[] bytes = original.getBytes("UTF-8");
//             md5.update(bytes);
//             BigInteger integer = new BigInteger(md5.digest());
//             encyStr = integer.toString(16);
//         } catch (NoSuchAlgorithmException e) {
//             e.printStackTrace();
//         } catch (UnsupportedEncodingException e) {
//             e.printStackTrace();
//         }
//         return encyStr;
//     }
// }


// Path: encryption/src/test/java/TestEncryption.java
import com.zhangjikai.encrypt.Encryption;
import org.junit.Test;


/**
 * Created by ZhangJikai on 2016/10/26.
 */
public class TestEncryption {

    @Test
     public void testBase64() {
        String s = "\n" +
                "\n" +
                "                                                Sulfate-(O-6)+\n" +
                "                                                             |\n" +
                " Sulfate-(O-6)-a-D-Glcp2Me3Me4Me-(1-4)-b-D-GlcpA2Me3Me-(1-4)+|                  Sulfate-(O-6)+\n" +
                "                                                            ||                               |\n" +
                "                                                        a-D-Glcp-(1-4)-a-L-IdopA2Me3Me-(1-4)+|\n" +
                "                                                            ||                              ||\n" +
                "                                               Sulfate-(O-3)+|                          a-D-Glcp-(1-1)-methyl\n" +
                "                                                             |                              ||\n" +
                "                                                Sulfate-(O-2)+                 Sulfate-(O-3)+|\n" +
                "                                                                                             |\n" +
                "                                                                                Sulfate-(O-2)+\n";

        String encodeStr = Encryption.base64Encode(s);