std::string DecodeEMFString(std::string chars) { reverse(chars.begin(), chars.end()); bool flippy = (chars.length() % 2) == 1; for (std::size_t i = 0; i < chars.length(); ++i) { byte c = chars[i]; if (flippy) { if (c >= 0x22 && c <= 0x4F) c = (byte)(0x71 - c); else if (c >= 0x50 && c <= 0x7E) c = (byte)(0xCD - c); } else { if (c >= 0x22 && c <= 0x7E) c = (byte)(0x9F - c); } chars[i] = c; flippy = !flippy; } return chars; } std::string EncodeEMFString(std::string chars) { bool flippy = (chars.length() % 2) == 1; for (std::size_t i = 0; i < chars.length(); ++i) { byte c = chars[i]; if (flippy) { if (c >= 0x22 && c <= 0x4F) c = (byte)(0x71 - c); else if (c >= 0x50 && c <= 0x7E) c = (byte)(0xCD - c); } else { if (c >= 0x22 && c <= 0x7E) c = (byte)(0x9F - c); } chars[i] = c; flippy = !flippy; } reverse(chars.begin(), chars.end()); return chars; }