Ask Question

Name:
Title:
Your Question:

Answer Question

Name:
Your Answer:
User Submitted Source Code!


Description:
  123
Language: JAVA
Code:
public class IvWv9kDm {

    public static void main(String[] args) {
        System.out.println("Hello, World");
    }
package xyz.saveProject;

public class Main {
    public static void main(String[] args) {
        //DES算法 第二种
        String origin="17网络工程";
        System.out.println("原文:\n" + origin);
        CustomDES customDES=new CustomDES("测试",origin);
        byte[] c=customDES.deal(origin.getBytes(),1);
        System.out.println("密文:\n" + new String(c));
        byte[]p=customDES.deal(c,0);
        byte[] p_d=new byte[origin.getBytes().length];
        System.arraycopy(p,0,p_d,0,origin.getBytes().length);
        System.out.println("明文:\n" + new String(p));
    }
}


/*
        //DES算法 第一种
        * String data = "17网络工程";
        String ecData = DES.encrypt(data);
        String deData = DES.decrypt(ecData);
        System.out.println("原  文:" + data);
        System.out.println("加密后:" + ecData);
        System.out.println("解密后:" + deData);
        *
        //IDEA算法
        * IDEA idea = new IDEA();
        idea.getKey("test");//生成密匙
        String str = "17网络工程";
        String strEnc = idea.getEncString(str);//加密字符串,返回String的密文
        String strDes = idea.getDesString(strEnc);//把String 类型的密文解密
        System.out.println("原文:" + str);
        System.out.println("加密:" + strEnc);
        System.out.println("解密:" + strDes);
        *
        //AES算法
        * String input = "17网络工程";
        String key = "justarandomk";
        String encrypt = AES.aesEncrypt(input, key);
        String decrypt = AES.aesDecrypt(encrypt, key);
        System.out.println("加密前:" + input);
        System.out.println("AES加密后:" + encrypt);
        System.out.println("AES解密后:" + decrypt);
        *
        * */
}          
Comments: