Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / December 2005

Tip: Looking for answers? Try searching our database.

check if password is dictionary word

Thread view: 
ravimannan2002@yahoo.com - 20 Dec 2005 03:54 GMT
Hello!

I need to check wether or not a String is in a dictionary. I looked at
JSpell and I couldn't find anything that could help me.

I looked at the java.util.Dictionary class, and it's an empty
Hashtable.

Should I just load a database table with dictionary words and then
query that? I would prefer not.

Any hints,suggestions,ideas??

Thanks!
Scott W Gifford - 20 Dec 2005 04:54 GMT
> I need to check wether or not a String is in a dictionary. I looked
> at JSpell and I couldn't find anything that could help me.

The well-known C library to do this is called "cracklib".

A google search for "java cracklib" turns up these:

   http://sourceforge.net/projects/solinger/
   http://www.middleware.vt.edu/doku.php?id=middleware:opensource:password

I haven't used either one, but I've used the standard cracklib from
Perl before and it's quite good.

Hope this helps,

----Scott.
Roedy Green - 20 Dec 2005 05:11 GMT
>I need to check wether or not a String is in a dictionary. I looked at
>JSpell and I couldn't find anything that could help me.

you need to create a HashSet of legal words.  Then you look words up
to see if they are included.

The complications are handling plurals, guess the right word spelled
incorrectly.  

You might google for a 3rd party dictionary with a Java interface.
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

"." - 20 Dec 2005 21:08 GMT
> Hello!
>
> I need to check wether or not a String is in a dictionary. I looked at
> JSpell and I couldn't find anything that could help me.

Could you elaborate? What about JSpell does not work for you?

> I looked at the java.util.Dictionary class, and it's an empty
> Hashtable.

Yes. In computer science Dictionary is an abstract data type (ADT). You
would still have to populate the structure with the data. Dictionary is
obsolete. You'd probably want to use something that implements Map or
Collection.

> Should I just load a database table with dictionary words and then
> query that? I would prefer not.

If that works for you. Bottom line, you will have to populate something
whatever you decide to do.

> Any hints,suggestions,ideas??
>
> Thanks!

Signature

Send e-mail to: darrell dot grainger at utoronto dot ca

castillo.bryan@gmail.com - 21 Dec 2005 04:58 GMT
I don't know anything about JSpell, but I know you could use jazzy
http://jazzy.sourceforge.net/.  There is a method to see if a word is
spelled correctly and a method to get suggestions for a mispelled word.
I would think you could use the getSuggestions method to make sure,
somebody didn't use a word that was too close to a dictionary word.

>From what I remember Jazzy used disk io for reading dictionary files
and caching data on the words.  When I used it before, I think I had to
create a singleton for the Dictionary and put synchronization blocks
around getting and checking the dictionary.  Because it uses files and
has to write the files, it might not work well in a Servlet/JSP
environment though.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.