MCPcopy Index your code
hub / github.com/f0ng/autoDecoder / encode

Method encode

src/burp/ui/SM4.java:42–53  ·  view source on GitHub ↗

使用指定的加密算法和密钥对给定的字节数组进行加密 @param inputByte 要加密的字节数组 @param key 加密所需的密钥 @return 加密后的字节数组 @throws Exception 如果加密时发生错误,则抛出异常

(byte [] inputByte, byte [] key)

Source from the content-addressed store, hash-verified

40 * @throws Exception 如果加密时发生错误,则抛出异常
41 */
42 public static byte [] encode(byte [] inputByte, byte [] key) throws Exception {
43 // 获取加密实例
44 Cipher c = Cipher.getInstance(transformation);
45 // 根据密钥的字节数组创建 SecretKeySpec
46 SecretKeySpec secretKeySpec = new SecretKeySpec(key, name);
47 // 创建 IvParameterSpec 对象,使用默认向量和字符集
48 IvParameterSpec ivParameterSpec = new IvParameterSpec(Default_iv.getBytes(StandardCharsets.UTF_8));
49 // 初始化加密实例
50 c.init(Cipher.ENCRYPT_MODE, secretKeySpec, ivParameterSpec);
51 // 返回加密后的字节数组
52 return c.doFinal(inputByte);
53 }
54
55 public static void decodeFile(String inputFilePath, String outputFilePath, String key) throws Exception {
56 byte[] inputBytes = Files.readAllBytes(Paths.get(inputFilePath));

Callers 3

encodeFileMethod · 0.95
mainMethod · 0.95
encryptKeyivmodeMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected