Einzelnen Beitrag anzeigen
Alt 10.02.09, 08:33   #4 (permalink)
odigo
Senior Member
 
Benutzerbild von odigo
 
Registriert seit: 25.12.04
odigo Leistung: 8086odigo Leistung: 8086
odigo eine Nachricht über ICQ schicken
Likes: 54
Standard

Mit Google hab ich das hier gefunden:

Code:
/*     MySQL 4.1.1 password hashing: SHA conversion (see RFC 2289, 3174) twice     applied to the password string, and then produced octet sequence is     converted to hex string.     The result of this function is used as return value from PASSWORD() and     is stored in the database.   SYNOPSIS     make_scrambled_password()     buf       OUT buffer of size 2*SHA1_HASH_SIZE + 2 to store hex string     password  IN  NULL-terminated password string */

typedef unsigned long ulong;
typedef unsigned char uchar;

void hash_password(ulong *result, const char *password)
{
  register ulong nr=1345345333L, add=7, nr2=0x12345671L;
  ulong tmp;
  for (; *password ; password++)
  {
    if (*password == ' ' || *password == '\t')
      continue;            /* skipp space in password */
    tmp= (ulong) (uchar) *password;
    nr^= (((nr & 63)+add)*tmp)+ (nr << 8);
    nr2+=(nr2 << 8) ^ nr;
    add+=tmp;
  }
  result[0]=nr & (((ulong) 1L << 31) -1L); /* Don't use sign bit (str2int) */;
  result[1]=nr2 & (((ulong) 1L << 31) -1L);
  return;
}

void make_scrambled_password(char *to,const char *password)
{
  ulong hash_res[2];
  hash_password(hash_res,password);
  sprintf(to,"%08lx%08lx",hash_res[0],hash_res[1]);
}
Quelle

Vielleicht hilfts dir.

Gruß odigo
odigo ist offline   Mit Zitat antworten
 

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61