views:

121

answers:

1

As seen in RFC2289 (S/KEY), there is a list of words that must be used when converting the hexadecimal string into a readable format.

How would i go about doing so?

The RFC mentions:

The one-time password is therefore converted to, and accepted as, a sequence of six short (1 to 4 letter) English words. Each word is chosen from a dictionary of 2048 words; at 11 bits per word, all one-time passwords may be encoded.

Read more: http://www.faqs.org/rfcs/rfc1760.html#ixzz0fu7QvXfe

Does this mean converting a hex into decimal and then using that as an index for an array of words. The other thing it could be is using a text encoding e.g. 1111 might equal dog in UTF-8 encoding

thanks in advance for your help!

A: 

There's no need to convert to decimal. If your hex value is a string, just convert it to a number (for example, with Integer.valueOf(value, 16)). Then use that number to look up the word. If you can store the whole dictionary in memory, use the number as the index. If you can't store it in memory, use it to control how far into the dictionary file you look (if every item is on a separate line, read that many lines into the file). If you've got a database somewhere, use the number as the table's key and select by key.

atk
By number i assume you mean a number in base 10, also known as a decimal. I was hoping that there was an actual method that i must follow in terms of the s/key system
Garbit
You mean you were looking for an API, like http://sourceforge.net/projects/otp-j2me/ ?Regarding "number", i mean a java representation of a number - an int, double, short, etc. Integer.valueOf(string, radix), with a radix of 16, will convert a hexadecimal string to an int. If your string is base 10, you can use Integer.valueOf(string) or use 10 for the radix.
atk