Created
December 29, 2025 12:26
-
-
Save LightningStalker/98cb340466498219b25f5a7a425d7ece to your computer and use it in GitHub Desktop.
Another demo for the C++ hexdump of previous gist (need the hxd.hpp)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* Compile with $ g++ -o fl fl.cpp | |
| * Project Crew™ 12/28/2025 | |
| */ | |
| #include <iostream> | |
| #include <iomanip> | |
| using namespace std; | |
| #include "fl.hpp" | |
| #include "hxd.hpp" | |
| #define MYB "Lorem ipsum dolor sit amet, " \ | |
| "consectetuer adipiscing elit." | |
| int | |
| main() | |
| { | |
| unsigned char myb[] = MYB, n = W; | |
| unsigned long int c, mybsize = sizeof(myb); | |
| /* register */ uint8_t t; | |
| /* turn the string to unprintable junk chars */ | |
| for(c = 0; c < mybsize - 1; c++) | |
| { | |
| // cout << c << ' '; | |
| t = myb[c]; // take each char and ... | |
| t += A; // add (pretty obvious) | |
| t = (t << S) | (t >> (N - S)); // bitwise rotate | |
| t ^= n; // ... NOT | |
| t -= A; // subtract | |
| myb[c] = t; // store back to array | |
| } | |
| /* take a lQQk at what we got */ | |
| hxd(myb, mybsize); | |
| cout << "\n\n"; | |
| cout << ' ' << myb << endl; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #define A 3 | |
| #define N 8 | |
| #define S 4 | |
| #define W -1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment