hcrypto.analyzer.tool
Class Dictionary

java.lang.Object
  extended by hcrypto.analyzer.tool.Dictionary
Direct Known Subclasses:
PatternDictionary

public class Dictionary
extends java.lang.Object

Implements a searchable dictionary that can be used by cryptanalysis objects. Each entry in the dictionary consists of a word and its relative frequency. The frequency is stored as an int represented as a String. For example, "the" "38940" "a" "32901" To Test: java Dictionary /usr/share/lib/dict/words *


Field Summary
static int BIG_DICT
           
static int KUCERA_100
           
static int KUCERA_340
           
static int KUCERA_3500
           
static int KUCERA_50
           
static int MIN_FREQ
           
 
Constructor Summary
Dictionary()
          The default constructor reads words from the Unix word list.
Dictionary(java.lang.String filename)
           
Dictionary(java.lang.String filename, boolean linebreaks)
          Creates a dictionary from the named file.
Dictionary(java.lang.String filename, boolean linebreaks, int minfreq)
           
 
Method Summary
 boolean contains(java.lang.String word)
           
 java.lang.String getDescriptor(int i)
           
 java.lang.String getDictionaryName()
           
 double getFreq(java.lang.String word)
           
static void main(java.lang.String[] args)
           
 int size()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BIG_DICT

public static final int BIG_DICT
See Also:
Constant Field Values

KUCERA_340

public static final int KUCERA_340
See Also:
Constant Field Values

KUCERA_100

public static final int KUCERA_100
See Also:
Constant Field Values

KUCERA_50

public static final int KUCERA_50
See Also:
Constant Field Values

KUCERA_3500

public static final int KUCERA_3500
See Also:
Constant Field Values

MIN_FREQ

public static final int MIN_FREQ
See Also:
Constant Field Values
Constructor Detail

Dictionary

public Dictionary()
The default constructor reads words from the Unix word list.


Dictionary

public Dictionary(java.lang.String filename)

Dictionary

public Dictionary(java.lang.String filename,
                  boolean linebreaks)
Creates a dictionary from the named file. If linebreaks is true, it assumes the words are listed one per line. Otherwise, it assumes words are listed several per line.

Parameters:
filename - a String giving the name of the dictionary file
linebreaks - set to true iff the words are listed one per line

Dictionary

public Dictionary(java.lang.String filename,
                  boolean linebreaks,
                  int minfreq)
Method Detail

getDictionaryName

public java.lang.String getDictionaryName()

contains

public boolean contains(java.lang.String word)

getFreq

public double getFreq(java.lang.String word)

size

public int size()

getDescriptor

public java.lang.String getDescriptor(int i)

main

public static void main(java.lang.String[] args)