- Timestamp:
- 2006-06-28T14:47:05Z (18 years ago)
- Branches:
- master
- Children:
- 5c9512f
- Parents:
- b3c467b
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
lib/rc4.c
rb3c467b r1719464 39 39 40 40 #include <glib.h> 41 #include <gmodule.h> 41 42 #include <stdlib.h> 42 43 #include <string.h> 44 #include "misc.h" 43 45 #include "rc4.h" 44 46 … … 134 136 key = g_malloc( key_len ); 135 137 strcpy( (char*) key, password ); 136 for( i = 0; i < RC4_IV_LEN; i ++ ) 137 key[key_len-RC4_IV_LEN+i] = crypt[0][i] = rand() & 0xff; 138 139 /* Add the salt. Save it for later (when decrypting) and, of course, 140 add it to the encryption key. */ 141 random_bytes( crypt[0], RC4_IV_LEN ); 142 memcpy( key + key_len - RC4_IV_LEN, crypt[0], RC4_IV_LEN ); 138 143 139 144 /* Generate the initial S[] from the IVed key. */
Note: See TracChangeset
for help on using the changeset viewer.