Skip to content

Instantly share code, notes, and snippets.

@etodanik
Created April 28, 2017 18:30
Show Gist options
  • Save etodanik/ea51b8061ad88b62666bbbe941edd4aa to your computer and use it in GitHub Desktop.
Save etodanik/ea51b8061ad88b62666bbbe941edd4aa to your computer and use it in GitHub Desktop.
getDecryptedChar() function for Shabak Challenge Part 2
uint8_t getDecryptedChar(uint8_t c, uint8_t operationCode, uint8_t operationParameter) {
switch (operationCode) {
case Xor:
return c ^ operationParameter;
break;
case Add:
return c + operationParameter;
break;
case Subtract:
return c - operationParameter;
break;
default:
cout << "Invalid operation code: " << operationCode << endl;
break;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment