Hello,

I need to encrypt a password with a DES key, I'm trying the following code:
      char * buff[20];
     int theDESCheckResult;
     DES_cblock * theDESKey1;
     DES_key_schedule *theSchedule;
     DES_cblock * theOutput;
 
     ALMLog (@"Enter your DBPassword");
     fgets((char *)&buff, 10, stdin);
  
         theDESKey1 = [[[NSProcessInfo processInfo] globallyUniqueString] 
UTF8String];
         RAND_seed(theDESKey1, strlen(theDESKey1));
 
     theDESCheckResult = DES_set_key_checked(theDESKey1, theSchedule);
     DES_ecb_encrypt(buff, theOutput, theSchedule, DES_ENCRYPT);
  
The DES key is correctly generated but the DES_set_key_checked () function 
returns -1 which means that the parity is wrong and the function 
DES_ecb_encrypt () cannot be executed.

Bests Regards
Driss

       
---------------------------------
 Envoyé avec Yahoo! Mail.
Capacité de stockage illimitée pour vos emails. 

Reply via email to