Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi all,
Vanilla are planning an update to the site on April 24th (next Wednesday). It is a major PHP8 update which is expected to boost performance across the site. The site will be down from 7pm and it is expected to take about an hour to complete. We appreciate your patience during the update.
Thanks all.

ZyXEL WEP keys

  • 03-03-2009 3:17pm
    #1
    Closed Accounts Posts: 1,567 ✭✭✭


    some months back, found some code that generates the WEP keys.

    most ZyXEL routers are shipped with WPA-PSK on by default so this is just posted for anyone who might be interested in how they're generated.thats all

    since around this time last year, the algorithms have changed.

    [PHP]char *genKey64(char *password, unsigned char *output)
    {
    size_t pass_len;
    unsigned char *p = output;
    unsigned int seed = 0;

    int i,j;

    if((pass_len = strlen(password)) != 0) {
    for(i = 0;i < pass_len;i++) {
    ((unsigned char*)&seed)[i % 4] ^= password;
    }
    }
    for(i = 0;i < 4;i++) {
    for(j = 0;j < 5;j++, p += 2) {
    seed = 214013 * seed + 2531011;
    sprintf(p,"%02x",(seed >> 16) & 0xff);
    }
    }

    return(output);
    }

    char *genKey128(char *input, unsigned char *output)
    {
    size_t pass_len;
    unsigned char wep_key[16]={0};
    char password[64];
    MD5_CTX ctx;

    int i;

    if((pass_len = strlen(input)) != 0) {

    for(i = 0;i < 64;i++)
    password = (input[i % pass_len]);
    }

    MD5Init(&ctx);
    MD5Update(&ctx,password,sizeof(password));
    MD5Final(wep_key,&ctx);

    for(i = 0;i < 13;i++)
    sprintf(&output[i*2],"%02x",wep_key);

    return(output);
    }[/PHP]


Advertisement