in reply to Re: Trying my hand at obfuscation
in thread Trying my hand at obfuscation

Interesting, on windows systems it prints up J<-ust a<-nother P<-erl h<-acker I wonder if the arrow is removing the character on your Linux. I know absolutely nothing about Linux. maybe one of the other Monks might know why it does that. Kerry
"Yet what are all such gaieties to me
Whose thoughts are full of indices and surds?"
quotes the Lama

Replies are listed 'Best First'.
Re: Trying my hand at obfuscation
by jonadab (Parson) on Feb 16, 2003 at 04:00 UTC

    That explains it. The left arrow (is that decimal 27, or decimal 17?) is not a printable character on most systems. On DOS, of course, almost all (over 250) of the 256 Extended ASCII characters are printable (there are even visual representation for CR and LF), but on other systems many of them are not. Windows 9x took away the top half (characters above 127 are different from one Windows system to another, depending on stuff), but many of the lower chars (below 32) are still printable. But that's not portable at all, because those are control characters, and on many systems they do stuff. Also, some hardware (dumb terminals, especially) is physically incapable of displaying them; there is no visual representation for them, but if they are sent they control the behavior of the terminal in various ways. Apparently, gnome-terminal (and therefore probably most Linux terminals and consoles) handle the character you printed in a way that causes the following character to not show. It might do something different on a different type of Unix, however, let alone VMS or what-have-you.

    My ASCII chart shows leftward arrows for 027 and 017; the former is ESC and is used in ANSI escape sequences. (You can also use ANSI escape sequences on DOS if you have ANSI.SYS, which used to be a standard thing almost everyone installed back in the days of DOS 3. We used it to have our prompt be different colors, put the time on the top line of the screen, and stuff like that. Some Win32 terminal emulators also support these, but I don't know about the Windows command prompt.) This might be what is happening. If so, it might actually be somewhat more portable than what I described; ANSI sequences are almost approximately similar to something that might be described as nearly standard. OTOH, if the character is just being taken as a garden-variety control character by the terminal (which is almost certainly the case if it's decimal 17), then like I said behavior might vary considerably from system to system.

    It is also entirely possible that this might not work out exactly the same way in NT/2K/XP as it does in Win9x/Me, because the behavior you are seeing in Windows is descended from DOS, and NT might never have implemented it that way.

    sub A{while($_[0]){$d=hex chop$_[0];foreach(1..4){$_[1].=($d %2)?1:0;$d>>=1;}}return$_[1];}sub J{$_=shift;while($_){$c=0; while(s/^0//){$c++;}s/^1//;$_[1].=(' ','|','_',"\n",'\\','/' )[$c]}@_}$PH="16f6da116f6db14b4b0906c4f324";print J(A($PH));