com.strangelight.db
Class Cryptword

java.lang.Object
  |
  +--com.strangelight.util.MyString
        |
        +--com.strangelight.db.Cryptword

public class Cryptword
extends MyString

An extension of MyString specifically for manipulating encrypted passwords.

See Also:
Cleartext

Constructor Summary
Cryptword()
           
Cryptword(Cleartext s)
          Creates a new Cryptword object by encrypting the Cleartext string susing a secure one-way hash algorithm.
Cryptword(Cryptword s)
           
 
Method Summary
 boolean equals(MyString compareTo)
          Tests for equality between this Cryptword string and another string.
 java.lang.String toString(int length)
          Gets the first length characters of the encrypted String.
 
Methods inherited from class com.strangelight.util.MyString
concat, concat, concat, equals, getBytes, length, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Cryptword

public Cryptword()

Cryptword

public Cryptword(Cleartext s)
Creates a new Cryptword object by encrypting the Cleartext string susing a secure one-way hash algorithm.

See Also:
Cleartext.toCryptword()

Cryptword

public Cryptword(Cryptword s)
Method Detail

equals

public boolean equals(MyString compareTo)
Tests for equality between this Cryptword string and another string. The exact definition of "equality" depends on the type of the compareTo string. If compareTo is of type Cleartext, then equals returns true if and only if* this string is the encrypted form of compareTo. Thus equals can be used to compare an encrypted string with an unencrypted string, without explicitly encrypting or decrypting either one. In other words, s.toCryptword().equals(s) will always return true.

(*For all practical purposes. It is theoretically possible for two different Cleartext strings to encrypt to the same Cryptword, so the "and only if" part of this assertion is not technically true, though the odds of such "key collisions" are infinitessimal.)

Overrides:
equals in class MyString
Parameters:
compareTo - An instance of MyString to compare to this one for equality.
Returns:
true if this string and the compareTo string are equal, false otherwise. See above for the exact definition of "equal".

toString

public java.lang.String toString(int length)
Gets the first length characters of the encrypted String.