package com.philisense.www.utils.des;

public class RegistCodeCript {
    private static final String keyPwd = "flxshareflxshare";

    public static void main(String[] args) {
    	/*
        System.out.println(EncriptData("SA"));
        System.out.println(EncriptData("12345"));
        String username = DecriptData("BylFNsGQzF4=");
        String pwd = DecriptData("bBQQBmcGk0/8rMf0NOtC3w==");
        System.out.println("username:" + username);
        System.out.println("pwd:" + pwd);
        */
    }

    public static String EncriptData(String inStr) {
        CRC32 crc = new CRC32();
        String key = crc.getData(keyPwd.trim());
        DES des = new DES();
        String retStr = des.encriptData(inStr.trim(), key);
        return retStr;
    }

    public static String DecriptData(String inStr) {
        CRC32 crc = new CRC32();
        String key = crc.getData(keyPwd.trim());
        DES des = new DES();
        String retStr = des.decriptData(inStr.trim(), key);
        return retStr;
    }

    public static String Encript(String inStr, String keyStr) {
        CRC32 crc = new CRC32();
        String key = crc.getData(keyStr.trim());
        DES des = new DES();
        String retStr = des.encriptData(inStr.trim(), key);
        return retStr;
    }

    public static String Decript(String inStr, String keyStr) {
        CRC32 crc = new CRC32();
        String key = crc.getData(keyStr.trim());
        DES des = new DES();
        String retStr = des.decriptData(inStr.trim(), key);
        return retStr;
    }
}
