| 69 | } |
| 70 | |
| 71 | int 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 | |
| 99 | int command_encrypt_predefined_sfrc4(int argc, char** argv) { |
| 100 | if (argc != 4) { |
nothing calls this directly
no test coverage detected