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

Function command_encrypt_sfrc4

lite/tools/rc4_encrypt.cpp:120–146  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

118}
119
120int command_encrypt_sfrc4(int argc, char** argv) {
121 if (argc != 6) {
122 printf("Invalid encrypt_rc4 arguments.\n");
123 return 1;
124 }
125
126 uint64_t hash_key = std::stoull(argv[2], 0, 0);
127 uint64_t enc_key = std::stoull(argv[3], 0, 0);
128 const char* input_file_path = argv[4];
129 const char* output_file_path = argv[5];
130
131 std::vector<uint8_t> keys(128, 0);
132 uint64_t* data = reinterpret_cast<uint64_t*>(keys.data());
133 data[0] = hash_key;
134 data[1] = enc_key;
135
136 size_t size = 0;
137 auto input = read_file(input_file_path, size);
138 printf("Reading input file ...\n");
139 auto output = SimpleFastRC4::encrypt_model(input.get(), size, keys);
140
141 printf("Encrypting ...\n");
142 write_file(output_file_path, output);
143
144 printf("Done.\n");
145 return 0;
146}
147
148int command_hash(int argc, char** argv) {
149 if (argc != 3) {

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