com.strangelight.db
Class Cleartext
java.lang.Object
|
+--com.strangelight.util.MyString
|
+--com.strangelight.db.Cleartext
- public class Cleartext
- extends MyString
An extension of MyString
specifically for manipulating
cleartext (non-encrypted) passwords.
- See Also:
Cryptword
Method Summary |
boolean |
equals(MyString compareTo)
Tests for equality between this Cleartext string
and another string. |
Cryptword |
toCryptword()
Encrypts this Cleartext string using a secure one-way hash algorithm. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Cleartext
public Cleartext()
Cleartext
public Cleartext(MyString s)
Cleartext
public Cleartext(java.lang.String s)
equals
public boolean equals(MyString compareTo)
- Tests for equality between this
Cleartext
string
and another string. The exact definition of "equality" depends
on the type of the compareTo
string. If
compareTo
is of type Cryptword
, then
equals
returns true if and only if*
this string is the cleartext 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.equals(s.toCryptword())
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".
toCryptword
public Cryptword toCryptword()
- Encrypts this Cleartext string using a secure one-way hash algorithm.
- Returns:
- a Cryptword representation of this string.
- See Also:
Cryptword