> Even adding "debug" keyword did not assure me
> whether the problem is with my password definition:
> wpakey s3cur3-as-#311, for illustration (was not sure
> if the '#' has to be escaped somehow); or somewhere
> else. Finally, it was the latter, but it took me a while
> to realize that.
.. or maybe i should use simple english:
$ grep key /etc/hostname.ath0
wpakey s3cur3-as-#311
$ doas ifconfig ath0 | perl -ne 'print if /status|key/'
status: active
ieee80211: nwid m ... wpakey
0x15b752645ecc6e52bf04052097af3d16031019d953f5c96cbdfeeabd223b2c89 ...
$ ./wpakey.pl 's3cur3-as-#311' m
0x15b752645ecc6e52bf04052097af3d16031019d953f5c96cbdfeeabd223b2c89
$ cat wpakey.pl
#!/usr/bin/perl
use strict;
my $pw = $ARGV[0];
my $salt = $ARGV[1];
use Crypt::PBKDF2;
my $kdf = Crypt::PBKDF2->new(
hash_class => "HMACSHA1",
iterations => 4096,
output_len => 32
);
my $h = $kdf->PBKDF2_hex($salt, $pw);
print "0x$h\n";