From c1a9eee9c9aa0d3c7592fa75e70243e0297b3a0d Mon Sep 17 00:00:00 2001 From: fhx <308050795@qq.com> Date: 星期四, 06 四月 2023 10:38:03 +0800 Subject: [PATCH] 1.新增文件工具类 --- src/main/java/com/hx/util/SimpleEncrypt.java | 17 ++++------------- 1 files changed, 4 insertions(+), 13 deletions(-) diff --git a/src/main/java/com/hx/util/SimpleEncrypt.java b/src/main/java/com/hx/util/SimpleEncrypt.java index 69909b0..88f48a2 100644 --- a/src/main/java/com/hx/util/SimpleEncrypt.java +++ b/src/main/java/com/hx/util/SimpleEncrypt.java @@ -1,12 +1,6 @@ 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.*; /*** * 锟�?鍗曠殑鍔犲瘑绋嬪簭锛屽拰瑙e瘑绋嬪簭 @@ -54,11 +48,7 @@ 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; } @@ -73,7 +63,8 @@ */ public static String simpleDeCode(String dataString) throws Exception { // 杩涜瑙e瘑sun.misc.BASE64Decoder.BASE64Decoder() - byte[] enCode = new BASE64Decoder().decodeBuffer(dataString); + + byte[] enCode = Base64.getDecoder().decode(dataString); // 瑙e緱闅忔満鍊� String ranString = new String(enCode); -- Gitblit v1.8.0