Ejemplo n.º 1
0
/**
 * \brief Generate four 40 bit (5 byte) WEP subkeys from a string
 * \param str Plaintext password
 * \param keys Pointer to key buffer (at least 21 bytes long)
 * \note Key locations: keys[0-4], keys[5-9], keys[10-14], keys[15-20].
 * \ingroup wep
 */
void wep_keygen40(const gchar* str, guint8* keys)
{
    gint val, i, shift;

    // Seed is generated by xor'ing in the keystring bytes
    // into the four bytes of the seed, starting at the little end
    val = 0;
    for (i = 0; str[i]; i++) {
        shift = i & 0x3;
        val ^= (str[i] << (shift * 8));
    }

    wep_seedkeygen(val, keys);
}
Ejemplo n.º 2
0
Archivo: keygen.c Proyecto: 26714/xwrt
/*
 * generate four subkeys from a string using the defacto standard
 *
 * resultant keys are stored in
 *   four 40 bit keys: keys[0-4], keys[5-9], keys[10-14] and keys[15-20]
 */
void
wep_keygen40(char *str, u_char *keys)
{
    int val, i, shift;

    /*
     * seed is generated by xor'ing in the keystring bytes
     * into the four bytes of the seed, starting at the little end
     */
    val = 0;
    for(i = 0; str[i]; i++) {
        shift = i & 0x3;
        val ^= (str[i] << (shift * 8));
    }

    wep_seedkeygen(val, keys);
    return;
}