简单的Java加密

mac2024-02-21  42

package com.java.password;

import java.util.Base64; /**

加密测试@author Think

*/ public class Testpassword {

public static void main(String[] args) { //这个是系统自带的加密方式,安全性较低 //加密 String password="123"; //把需要加密的字符串放到里面加密 byte[] passwords=Base64.getEncoder().encode(password.getBytes()); System.out.println(passwords); //解密 byte[] by=Base64.getDecoder().decode(passwords); //String bString=new String(by); System.out.println(new String(by)); //System.out.println(bString); }

}

最新回复(0)