MCPcopy Create free account
hub / github.com/S3N4T0R-0X0/PixelCode-Attack / encrypt

Method encrypt

payload.cpp:809–820  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

807 }
808
809 std::vector<uint8_t> encrypt(const std::string& raw) {
810 std::vector<uint8_t> data(raw.begin(), raw.end());
811 data = pad(data);
812 std::vector<uint8_t> iv(16);
813 for (size_t i = 0; i < 16; ++i) iv[i] = rand() % 256;
814 std::vector<uint8_t> result = iv;
815 AES_ctx ctx_copy = ctx;
816 AES_ctx_set_iv(&ctx_copy, iv.data());
817 AES_CBC_encrypt_buffer(&ctx_copy, data.data(), data.size());
818 result.insert(result.end(), data.begin(), data.end());
819 return result;
820 }
821
822 std::string decrypt(const std::vector<uint8_t>& enc) {
823 if (enc.size() < 16) throw std::runtime_error("Invalid encrypted data");

Callers 2

execute_commandFunction · 0.80
mainFunction · 0.80

Calls 2

AES_ctx_set_ivFunction · 0.85
AES_CBC_encrypt_bufferFunction · 0.85

Tested by

no test coverage detected