Skip to main content
7 of 7
added 47 characters in body
user avatar
user avatar

(vintage) C - 88

No need for all these silly dedicated golfing languages. Better go back to the good old days, before the quiche eaters and their "program = algorithm+data" nonsense ruined all the fun.

The code is a C function, stored as a string.
It returns the binary value as an integer.

Run it in DosBox with Borland Turbo C 2.0.
There are no control characters in the string, so a copy-paste should work.
Compile with tiny memory model or else...

typedef int (* pfun)();
main ()
{
    pfun passwd = (pfun) "¬< sûŠDþ,#ÃEq{1Kt:=qQ+ƒ.?&m):|YH)†P$Pzs/7Tk,2o0&(CƒzIzB-E+\l^Dk‚sw.'..Hjp~T8WSN.pWc&,8Idhwƒq*jsq&„";

    printf ("password %d\n", passwd());
}

If you disassemble the start of the string, you'll see something like:

scan: lodsb
      cmp al,32
      jae scan
      mov al,[si-2]
      sub al, 35
      ret

since si is used as function address, it points directly to the code, followed by the passwords.

All values are shifted by 35 to avoid escaping control characters and double quotes.

The code is 11 bytes long, so it will work up to 12 characters.

Unfortunately, the 11th value (34) is too low to produce a valid password with an increased shift value (ret opcode is 195, so you would need a shift of 161, and the maximal shift to avoid a rollover is 255-99=156).

11 characters will produce a wrong value, and your virtual PC will experience severe (and usually lethal) undefined behaviours with 10 characters or less.

user16991