des.c
static char *key_init(char *k) {
    size_t len = bstr_len(k);
    if (len == 0)
        return NULL;    //key is NULL or empty, unfixable
    if (len < 64)
        k = bstr_pad(k, 64);

    char *new = des_permute(k, PC1, 56);
    if (len < 64)
        free(k);    //bstr_pad() dynamically allocates
    return new;
}
/**
 * Initialises the specified key, permutating it to 56 bits. The returned 
 * key will be dynamically allocated. If any memory error occurred, then 
 * NULL will be returned. If the key is short, then it will be padded with 
 * 0. 
 *
 * PARAMETERS: 
 * k - the key to initialise
 *
 * RETURNS: 
 * The initialised key, or NULL if any error occurred. 
 */
Initialises the specified key, permutating it to 56 bits. The returned
key will be dynamically allocated. If any memory error occurred, then
NULL will be returned. If the key is short, then it will be padded with
0.

the key to initialise

The initialised key, or NULL if any error occurred.
Initialises the specified key permutating it to 56 bits . The returned key will be dynamically allocated . If any memory error occurred then NULL will be returned . If the key is short then it will be padded with 0 . the key to initialise The initialised key or NULL if any error occurred .
static char *key_init(char *k) {
    size_t len = bstr_len(k);
    if (len == 0)
        return NULL;    
    if (len < 64)
        k = bstr_pad(k, 64);
    char *new = des_permute(k, PC1, 56);
    if (len < 64)
        free(k);    
    return new;
}
static char * key_init ( char * k ) { size_t len = bstr_len ( k ) ; if ( len == 0 ) return NULL ; if ( len < 64 ) k = bstr_pad ( k , 64 ) ; char * new = des_permute ( k , PC1 , 56 ) ; if ( len < 64 ) free ( k ) ; return new ; }
Initialises the specified key, permutating it to 56 bits.
Initialises the specified key permutating it to 56 bits .
//key is NULL or empty, unfixable //bstr_pad() dynamically allocates