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

Method encodeFile

src/burp/ui/SM4.java:26–34  ·  view source on GitHub ↗

加载指定文件,对其进行加密,并将加密结果写入指定输出文件中 @param inputFile 要加密的输入文件路径 @param outputFile 加密后的输出文件路径 @param key 加密所需的密钥 @throws Exception 如果文件读取、加密或写入时出现错误,则抛出异常

(String inputFile, String outputFile, String key)

Source from the content-addressed store, hash-verified

24 * @throws Exception 如果文件读取、加密或写入时出现错误,则抛出异常
25 */
26 private static void encodeFile(String inputFile, String outputFile, String key) throws Exception {
27 // 读取输入文件中的所有字节
28 byte [] inputBytes = Files.readAllBytes(Paths.get(inputFile));
29 // 对输入字节数组进行加密
30 byte [] encodeByte = encode(inputBytes, key.getBytes(StandardCharsets.UTF_8));
31 // 将加密后的字节数组写入指定输出文件中
32 Files.write(Paths.get(outputFile),encodeByte);
33 System.out.println("File encoded successfully.");
34 }
35 /**
36 * 使用指定的加密算法和密钥对给定的字节数组进行加密
37 * @param inputByte 要加密的字节数组

Callers

nothing calls this directly

Calls 1

encodeMethod · 0.95

Tested by

no test coverage detected