Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

ZyXEL WEP keys

  • 03-03-2009 03: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