Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Hello World Obfuscation
#1
Before i go to bed and as my head is reeling from learning about packing udts in C++ and other things I had a thought and as such....this is about as obfuscated as i can make it in Qb64...If anyone can best it please DO!

Code: (Select All)
$CHECKING:OFF
SCREEN 13: DIM h AS _MEM: DIM b AS _UNSIGNED _BYTE: h = _MEMNEW(11)
FOR i = 0 TO 10: READ v: r = (v AND 240) / 16: g = (v AND 15)
  OUT &H3C8, i: OUT &H3C9, r: OUT &H3C9, g: OUT &H3C9, 0
NEXT
FOR j = 0 TO 10: OUT &H3C7, j
  r_in = INP(&H3C9): g_in = INP(&H3C9): b_trash = INP(&H3C9)
  _MEMPUT h, h.OFFSET + j, (r_in * 16 + g_in) AS _UNSIGNED _BYTE
NEXT
FOR k = 0 TO 10: _MEMGET h, h.OFFSET + k, b: o$ = o$ + CHR$(b): NEXT
_MEMFREE h: SCREEN 0: PRINT o$: END
DATA 72,101,108,108,111,32,87,111,114,108,100

Unseen

p.s. By JUST reading the code could you fathom its function?
Reply
#2
Those of us who work in the private sector just code:

Print "Hello World"

However it's a stretch to say this code was written by a government employee... because it actually functions. Hmm, I'm completely stumped.

Pete Big Grin
Reply
#3
Personally, I like simple and lazy code.  John's is just too much work for me.  

Here's a message saying "Steve is Amazing!!, obfuscated by me:

Code: (Select All)
Data &H4C4C4548,&H4F57204F,&H20444C52
For i = 1 To 3
Read i&: Print MKL$(i&);
Next

Again, just by reading the code, can you fathom its function? Big Grin
Reply
#4
(12-21-2025, 05:54 AM)Unseen Machine Wrote: Before i go to bed and as my head is reeling from learning about packing udts in C++ and other things I had a thought and as such....this is about as obfuscated as i can make it in Qb64...If anyone can best it please DO!

Code: (Select All)
$CHECKING:OFF
SCREEN 13: DIM h AS _MEM: DIM b AS _UNSIGNED _BYTE: h = _MEMNEW(11)
FOR i = 0 TO 10: READ v: r = (v AND 240) / 16: g = (v AND 15)
  OUT &H3C8, i: OUT &H3C9, r: OUT &H3C9, g: OUT &H3C9, 0
NEXT
FOR j = 0 TO 10: OUT &H3C7, j
  r_in = INP(&H3C9): g_in = INP(&H3C9): b_trash = INP(&H3C9)
  _MEMPUT h, h.OFFSET + j, (r_in * 16 + g_in) AS _UNSIGNED _BYTE
NEXT
FOR k = 0 TO 10: _MEMGET h, h.OFFSET + k, b: o$ = o$ + CHR$(b): NEXT
_MEMFREE h: SCREEN 0: PRINT o$: END
DATA 72,101,108,108,111,32,87,111,114,108,100

Unseen

p.s. By JUST reading the code could you fathom its function?

Honestly, I think I'd have a good idea about what it's supposed to do -- but just because the DATA statements are so obvious to me, and I've seen those ASCII codes so many times they almost untranslate in my brain instantly.  

They're the glaring flaw in your process and need a bit more complexity so as to not be so quickly deciphered.  Wink
Reply
#5
I havent run your code yet, but does it write the character as color data, the read it to make the letters?  Ill run it later and see what it looks like.  Small things like this can be fun, like a puzzle.

This brings back memories.   Back in the Qbasic days somebody ran a contest to make the crappiest Hello World program. Had to dig up my entry.  This works in Qbasic, but not in QB64, i suppose because QB64 returns different representation of large numbers.  My code is even more crappier now!

- Dav

Edit: fixed it, I changed the value from 5.850962265337605D+53 to 74.70931410366913 and it will work in QB64.

Code: (Select All)
'Hello World program by Dav
'Coded for a "Crappiest Hello World" contest,
'Prints Hello World!  (QB64 version)
sd82j$ = "07223410145610878410887311123403256708"
xZdG7Z2$ = sd82j$ + "7343111234114543108775100343033234"
IF LTRIM$(STR$(VAL(xZdG7Z2$) / 1.234567891234568D+17)) = "74.70931410366913" THEN
FOR QhSxdXvw = 1 TO LEN(xZdG7Z2$) STEP ((LEN(sd82j$) / 2) - 7) / 2
PRINT CHR$(VAL(MID$(xZdG7Z2$, QhSxdXvw, (((LEN(sd82j$) / 2) - 7) / 4))));
NEXT
END IF

Find my programs here in Dav's QB64 Corner
Reply
#6
My 15 minutes of wasted downtime Blush
Code: (Select All)
CONST s = "++++++++,-----,------------,------------,---------------,,+++++++++++++++++++++++,---------------,------------------,------------,----"
CONST n = _CEIL(_PI * 10)

DIM AS INTEGER sl, sl2, i
DIM c AS STRING * 1

sl = LEN(s)
i = 0

WHILE sl > 0
    sl2 = sl
    c = MID$(s, i, 1)
    IF c = "+" THEN
        WHILE MID$(s, i, 1) = "+"
            sl = sl - 1
            i = i + 1
        WEND
        PRINT CHR$(sl2 - sl + _SHL(n, 1));
    ELSEIF c$ = "-" THEN
        WHILE MID$(s, i, 1) = "-"
            sl = sl - 1
            i = i + 1
        WEND
        PRINT CHR$(sl2 - sl + _SHL(n, 1) + n);
    ELSE
        PRINT CHR$(n);
        sl = sl - 1
        i = i + 1
    END IF
WEND
Reply
#7
That's unique and well obfuscated, @tantalus. Smile

@Unseen Machine: Hmm, I'm going to have study yours a bit more when I get back home today to figure it out completely.  Have a good day... Cool

- Dav

Find my programs here in Dav's QB64 Corner
Reply
#8
(12-21-2025, 12:01 PM)tantalus Wrote: My 15 minutes of wasted downtime Blush
Code: (Select All)
CONST s = "++++++++,-----,------------,------------,---------------,,+++++++++++++++++++++++,---------------,------------------,------------,----"
CONST n = _CEIL(_PI * 10)

DIM AS INTEGER sl, sl2, i
DIM c AS STRING * 1

sl = LEN(s)
i = 0

WHILE sl > 0
    sl2 = sl
    c = MID$(s, i, 1)
    IF c = "+" THEN
        WHILE MID$(s, i, 1) = "+"
            sl = sl - 1
            i = i + 1
        WEND
        PRINT CHR$(sl2 - sl + _SHL(n, 1));
    ELSEIF c$ = "-" THEN
        WHILE MID$(s, i, 1) = "-"
            sl = sl - 1
            i = i + 1
        WEND
        PRINT CHR$(sl2 - sl + _SHL(n, 1) + n);
    ELSE
        PRINT CHR$(n);
        sl = sl - 1
        i = i + 1
    END IF
WEND
Fully baffled me especially as you include commands i've never seen before!

@Dav = Bang on with your interpretation of mine, yours id guess writes something but what it prints from just reading it would be beyond me!

Thanks for all the renditions folks! Madness!

Unseen
Reply
#9
Code: (Select All)
_Title "not(barcode)"
Screen _NewImage(250, 32, 32)
For i = 1 To 20
    k = Val(Mid$("00003030200302003222", i, 1))
    Line (70 + j + 2, 10)-Step(k, 9), _RGB32(-(k < 3) * 255), BF
    j = j + k + 4
Next i
Sleep
System
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)