2 * WPA Supplicant - ASCII passphrase to WPA PSK tool
3 * Copyright (c) 2003-2004, Jouni Malinen <jkmaline@cc.hut.fi>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
9 * Alternatively, this software may be distributed under the terms of BSD
12 * See README and COPYING for more details.
22 int main(int argc, char *argv[])
24 unsigned char psk[32];
26 char *ssid, *passphrase;
29 printf("usage: wpa_passphrase <ssid> <passphrase>\n");
36 if (strlen(passphrase) < 8 || strlen(passphrase) > 63) {
37 printf("Passphrase must be 8..63 characters\n");
41 pbkdf2_sha1(passphrase, ssid, strlen(ssid), 4096, psk, 32);
43 printf("network={\n");
44 printf("\tssid=\"%s\"\n", ssid);
45 printf("\t#psk=\"%s\"\n", passphrase);
47 for (i = 0; i < 32; i++)
48 printf("%02x", psk[i]);