MCPcopy Create free account
hub / github.com/TelegramMessenger/cocoon / encrypt_string

Function encrypt_string

runners/helpers/ValidateRequest.cpp:261–269  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

259}
260
261static std::string encrypt_string(td::Slice S, td::Slice secret) {
262 auto enc_value = tde2e_core::MessageEncryption::encrypt_data(S, secret);
263 td::UniqueSlice buf(2 * enc_value.size() + 4);
264 auto t = buf.as_mutable_slice();
265 t.copy_from("ENC_");
266 t.remove_prefix(4);
267 t.copy_from(td::hex_encode(enc_value.as_slice()));
268 return buf.as_slice().str();
269}
270
271static td::Status decrypt_all_strings(nlohmann::json &b, td::Slice shared_secret) {
272 for (auto &[key, value] : b.items()) {

Callers 1

encrypt_all_stringsFunction · 0.85

Calls 1

as_sliceMethod · 0.80

Tested by

no test coverage detected