Advertisement

Base64编码解码应用

阅读量:

Base64加密技术解析

这个加密是固定加密,有些不安全,拿到加密串可以解密了

直接提供代码示例:

复制代码
    package com.zjy.knife4j.controller;
    
    import java.io.UnsupportedEncodingException;
    import java.util.Base64;
    
    public class Test2 {
    
    public static void main(String[] args) throws UnsupportedEncodingException {
        // base64加密
        String encode = Base64.getEncoder().encodeToString("王中王火腿肠".getBytes("UTF-8"));
        String encode2 = Base64.getEncoder().encodeToString("中王".getBytes("UTF-8"));
        System.out.println(encode);
        System.out.println(encode2);
        // base64解密

全部评论 (0)

还没有任何评论哟~