Operating System - HP-UX
1833413 Members
3343 Online
110052 Solutions
New Discussion

Reading the word dictionary used by 'spell'

 
Leslie Chaim
Regular Advisor

Reading the word dictionary used by 'spell'

For my specific purposes, I am trying to get a random list of words. How can I read in the ASCCI values of the files in /usr/share/dict?
If life serves you lemons, make lemonade
2 REPLIES 2
Darren Prior
Honored Contributor

Re: Reading the word dictionary used by 'spell'

Hi Leslie,

I'm afraid I don't know of a way to achieve your objective. There are some commands mentioned in spell's man page for _adding_ words to the dictionary, but only the spell program is aware of how to unhash the data files into words again.

If you're looking for lists of words, there are web pages that contain lists for various purposes - ie for passwords where all the letter i's have been changed to 1's, etc.

regards,

Darren.
Calm down. It's only ones and zeros...
A. Clay Stephenson
Acclaimed Contributor

Re: Reading the word dictionary used by 'spell'

Sorry, that dog won't hunt. Spell uses a hash and as such it is not a one-to-one reversible algorithm. You would have the same problem trying to decode passwd entries because they are a hash as well. There is actually an N-to-one relationship so that more than one key could produce the same hashcode.

What you can do is download the source of Gnu game 'Scrabble' and use the file 'scrabbledict'.

http://gatekeep.cs.utah.edu/hppd/hpux/Games/Board/scrabble-1.31/

You might also consider the use of a fixed sequence random number generator (i.e. supply a fixed seed) and then XOR each character in your dictionary with the output of the RNG. In this manner, the dictionary itself will be encrypted. If you supply the same RNG sequence and XOR the encrypted character you get back the plaintext character.
If it ain't broke, I can fix that.