Wednesday, February 18, 2015

Convert string into hex - iwconfig wifi key

I've played a bit with my wifi command line configuration. The iwconfig command needs the key represented as hexadecimal string, so here is the formula to convert string into hex. The od command does the work and tr command removes spaces:

$ echo -n "mykey" | od -A n -t x1 | tr -d ' '

Note: we need to escape special shell symbols

$ echo -n "mykey\$\$" | od -A n -t x1 | tr -d ' '

As I found out later the string can be given as parameter to the iwconfig key :).

No comments:

Post a Comment