this post was submitted on 07 Sep 2024
220 points (97.8% liked)
Programmer Humor
19453 readers
75 users here now
Welcome to Programmer Humor!
This is a place where you can post jokes, memes, humor, etc. related to programming!
For sharing awful code theres also Programming Horror.
Rules
- Keep content in english
- No advertisements
- Posts must be related to programming or programmer topics
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
If anyone wants to actually run this, here ya go:
Bonus points if you can deobfuscate it!
I don't know if this will work or even compile, but I feel like I'm pretty close.
Here's it with some amount of de-obfuscation:
Needless to say, the return value doesn't matter any more. So you can change it to
0
or69
depending upon your preferences.And more de-obf:
I guess I should have kept the recursion and straightened it out in the next step, but now that it's done...
The next step will just have an array of the characters that would be printed, so I'll leave it here.
Some kind of Caesar cipher you made?
Whoops! When I looked at the second time that the shift value is calculated, I wondered if it would be inverted from the first time, but for some reason I decided that it wouldn't be. But looking at it again it's clear now that (1 - i) = (-i + 1) = ((~i + 1) + 1), making bit 0 the inverse. Then I wondered why there wasn't more corruption and realized that the author's compiler must perform postfix increments and decrements immediately after the variable is used, so the initial shift is also inverted. That's why the character pairs are flipped, but they still decode correctly otherwise. I hope this version works better:
EDIT: I just got a chance to compile it and it does work.