[ale] FW: more info on crypt.

Bao Ha baoh at linuxwizardry.com
Thu Mar 29 10:19:25 EST 2001



Your 
crypt library is using DES, which only uses the first 8 characters as 
its
<SPAN 
class=593332215-29032001>salt.  MD5 will allow up to 32 characters, I 
believe.
<SPAN 
class=593332215-29032001> 
<SPAN 
class=593332215-29032001>Bao
<BLOCKQUOTE 
style="BORDER-LEFT: #0000ff 2px solid; MARGIN-LEFT: 5px; MARGIN-RIGHT: 0px; PADDING-LEFT: 5px">
  <FONT face=Tahoma 
  size=2>-----Original Message-----From: owner-ale at ale.org 
  [mailto:owner-ale at ale.org]On Behalf Of Chris FowlerSent: 
  Thursday, March 29, 2001 9:35 AMTo: 
  'ale at ale.org'Subject: [ale] FW: more info on crypt. 
  
  Below is code and output of 2 executions 
  Run 1: You entered: password 
  It was encrypted to: ctmNrZ7a6zlUA <FONT 
  size=2>The correct password is: ctmNrZ7a6zlUA <FONT 
  size=2>Correct! 
  Run 2: You entered: 
  password12345 It was encrypted to: 
  ctmNrZ7a6zlUA The correct password is: 
  ctmNrZ7a6zlUA Correct! 
  --------- test.c ----------------- <FONT 
  size=2>#include <unistd.h> 
  #define PASSWORD "ctmNrZ7a6zlUA" 
  int main(void) <FONT 
  size=2>{         <FONT 
  size=2>char password[32]; 
          char 
  *encrypted; 
          printf("password: 
  ");         <FONT 
  size=2>scanf("%32s", password); 
          encrypted = 
  crypt(password, PASSWORD); 
          // DEBUG 
          printf("You 
  entered: %s\n", password); 
          printf("It was 
  encrypted to: %s\n", encrypted); 
          printf("The 
  correct password is: %s\n", PASSWORD); 
          // END 
  DEBUG 
          if 
  (strcmp(encrypted, PASSWORD) == 0) 
          
          <FONT 
  size=2>printf("Correct!\n"); 
          else 
          
          <FONT 
  size=2>printf("Incorrect!\n"); 
          return 0; 
  } 
          




More information about the Ale mailing list