| | |
| | | package com.hx.util; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | import java.util.Random; |
| | | |
| | | import sun.misc.BASE64Decoder; |
| | | import sun.misc.BASE64Encoder; |
| | | import java.util.*; |
| | | |
| | | /*** |
| | | * �?单的加密程序,和解密程序 |
| | |
| | | public static String simpleEnCode(String dataString) { |
| | | // 组拼随机值 |
| | | String ranString = generateCheckCode(13).toString() + dataString + generateCheckCode(9).toString(); |
| | | |
| | | System.out.println(ranString); |
| | | // 进行加密 sun.misc.BASE64Encoder.BASE64Encoder() |
| | | String enCode = new BASE64Encoder().encodeBuffer(ranString.getBytes()); |
| | | |
| | | String enCode = new String(Base64.getEncoder().encode(ranString.getBytes())); |
| | | return enCode; |
| | | } |
| | | |
| | |
| | | */ |
| | | public static String simpleDeCode(String dataString) throws Exception { |
| | | // 进行解密sun.misc.BASE64Decoder.BASE64Decoder() |
| | | byte[] enCode = new BASE64Decoder().decodeBuffer(dataString); |
| | | |
| | | byte[] enCode = Base64.getDecoder().decode(dataString); |
| | | // 解得随机值 |
| | | String ranString = new String(enCode); |
| | | |