[comp.unix.xenix] GCC Bug under SCO Xenix/386

jsnyder@lehi3b15.csee.Lehigh.EDU (Jay Snyder) (03/29/90)

The following is a piece of code that I use for a primitive password encoding
scheme in my BBS software:

encodepw(pw,name)
char *pw,*name;
{
char i,ii;
ii=0x15;i=0;
while (*pw)
  {
  if (i>strlen(name)) i=0;
  *pw=*pw^(0x1f & name[i++])^(i++);
  *pw=*pw-5;
  if (*pw<'!') *pw=*pw+32;
  if (*pw==':') *pw='$';
  ++pw;
  }
}

here is the output from input: name="Username", passwd="password"

output from cc code:  "_bstyvoj"
output from gcc code: "`atszupi"


note that the gcc code is make each character of the output 1 less
numerically.

Anybody have any suggestions.

Also, I compiled the same code on an AT&T 3B15 running SYSV R3.1.1
and the results were the same as from cc on SCO.

My conclusion is that gcc has a bug.
-- 
====================================================
Jay A. Snyder       jsnyder@lehi3b15.csee.lehigh.edu
CSEE Dept.	    jsnyder%gdx@lehi3b15.csee.lehigh.edu
Lehigh University