code: public static String encrypt(String key,String data) {
      	if(data == null)
      		return null;
      	try{
  	    	DESKeySpec dks = new DESKeySpec(key.getBytes());	    	
  	    	SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DES");
  	        //key的长度不能够小于8位字节
  	        Key secretKey = keyFactory.generateSecret(dks);
  	        Cipher cipher = Cipher.getInstance(ALGORITHM_DES);
  	        AlgorithmParameterSpec paramSpec = new IvParameterSpec(IV_PARAMS_BYTES);;
  	        cipher.init(Cipher.ENCRYPT_MODE, secretKey,paramSpec);           
  	        byte[] bytes = cipher.doFinal(data.getBytes());            
  	        return byte2hex(bytes);
      	}catch(Exception e){
      		e.printStackTrace();
      		return data;
      	}
      }
docs: DES算法，加密
  
  @param data 待加密字符串
  @param key  加密私钥，长度不能够小于8位
  @return 加密后的字节数组，一般结合Base64编码使用
  @throws InvalidAlgorithmParameterException
  @throws Exception