encript
This commit is contained in:
21
src/main/java/com/flagnote/note/utils/SecretUtils.java
Normal file
21
src/main/java/com/flagnote/note/utils/SecretUtils.java
Normal file
@@ -0,0 +1,21 @@
|
||||
package com.flagnote.note.utils;
|
||||
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
|
||||
import cn.hutool.crypto.Mode;
|
||||
import cn.hutool.crypto.Padding;
|
||||
import cn.hutool.crypto.symmetric.AES;
|
||||
|
||||
public class SecretUtils {
|
||||
|
||||
private static AES aes = new AES(Mode.ECB, Padding.ZeroPadding,
|
||||
new SecretKeySpec("b9t3pzbmybc66cba".getBytes(), "AES"));
|
||||
|
||||
public static byte[] encodeNote(byte[] text) {
|
||||
return aes.encrypt(text);
|
||||
}
|
||||
|
||||
public static byte[] decodeNote(byte[] text) {
|
||||
return aes.decrypt(text);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user