MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / command_encrypt_rc4

Function command_encrypt_rc4

lite/tools/rc4_encrypt.cpp:71–97  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

69}
70
71int command_encrypt_rc4(int argc, char** argv) {
72 if (argc != 6) {
73 printf("Invalid encrypt_rc4 arguments.\n");
74 return 1;
75 }
76
77 uint64_t hash_key = std::stoull(argv[2], 0, 0);
78 uint64_t enc_key = std::stoull(argv[3], 0, 0);
79 const char* input_file_path = argv[4];
80 const char* output_file_path = argv[5];
81
82 std::vector<uint8_t> keys(128, 0);
83 uint64_t* data = reinterpret_cast<uint64_t*>(keys.data());
84 data[0] = hash_key;
85 data[1] = enc_key;
86
87 size_t size = 0;
88 auto input = read_file(input_file_path, size);
89 printf("Reading input file ...\n");
90 auto output = RC4::encrypt_model(input.get(), size, keys);
91
92 printf("Encrypting ...\n");
93 write_file(output_file_path, output);
94
95 printf("Done.\n");
96 return 0;
97}
98
99int command_encrypt_predefined_sfrc4(int argc, char** argv) {
100 if (argc != 4) {

Callers

nothing calls this directly

Calls 4

write_fileFunction · 0.85
read_fileFunction · 0.70
dataMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected