Need help. Specific function encryption

Hi.
I need to understand how can i encrypt specific function to protect my code. I know method that can crypt all executable file, but its very problematic method, bcos all AV-s detect my code as virus.

Please explain me how can i do this.

For example i have function
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
void hello(int t){
  std::cout << "Hello" << std::endl;
  std::cout << std::to_string(t) << std::endl;
}

// function to get my void rawdata
vector<unsigned char> getMyFunctionRawData(){
  // Some code here to return rawdata of my hello function
}

// after this i must encrypt the rawdata, have many ways, it simple.
// Let's Consider this is my encrypted rawdata

vector<unsigned char> rawdata = {
  0x7B,0x1E,0xE1,0xCE,0x13,0x33,0x66,0x37,
  0xE6,0x96,0x53,0x39,0xA3,0x94,0x0D,0x2C,
  ...
};


// and finaly runing decrypted raw data as function with arguments

void run(vector<unsigned char> raw, int t){
  
  auto decryptedRawdata = decryptMyRaw(rawdata);

  // some function to run my decrypted raw data,

}
Last edited on
Just don't give people your source code.
i understand @Repeater but i have some parts thats i need to encrypte. can you get me some solution.
In principle, you're trying run unchecked code.

It's tricky to find one that doesn't trigger a decent anti-virus checker. That's kinda the point of an anti-virus checker.
What are you actually trying to do? What do you want NOT to happen? Don't ask us how you can "encrypt your code", because that doesn't make much sense from what you've shown us.

What are you trying to prevent? If you didn't "encrypt your code", what bad thing might happen?
It's really not clear what you want.
Do you have sth. like this in your codestring password = "secret"; and don't want someone to see the word secret in a hex editor ?
Topic archived. No new replies allowed.