0

I've coded a password analyser for a school project. I want it to be able to test if their password contains a dictionary word in any place. For example, kdghdcheesegjgjd would still be flagged because it contains cheese. Would I need to find a file containing a list of all dictionary words, or is their such a built-in function?

Thanks.

Ryan Grainger
  • 21
  • 1
  • 5
  • did you check these answers? http://stackoverflow.com/questions/335517/a-dictionary-api-for-c http://stackoverflow.com/questions/5160615/english-language-dictionary-api – Aram Tchekrekjian Jun 24 '15 at 11:04
  • You would need a list of dictionary words, there is nothing built in to do this. (wordlist.aspell.net) – Alex K. Jun 24 '15 at 11:05

3 Answers3

0

Most languages don't have any (human language) dictionaries built into them. You will need to find/make your own and have the program read from that file.

A personal tip is to make your own very short one for testing purposes (say 5 words) to see that the program reads and interprets the file properly.

0

As stated by @Jonas Olsson, there is no built-in dictionary in VB. You need to create them on your own. And making it is fairly easy, but I'll show easier way to solve your problem. First make a text file containing all the words you want your program to check if it contains that word. Then save it somewhere else, for the sake of my example, I'll create a text file containing the word "cheese". So:

Dim myFile As String = "D:\test.txt" //Location of my txt file

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

    Dim item() As String = File.ReadAllLines(myFile) //Reads whatever your txt file contains

    //compares every line in your to text file to the password field
    For Each line As String In item 
        If txtPassword.Text.Contains(line) Then
            MessageBox.Show("Invalid password!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
        End If
    Next
End Sub

Hope that helps! Or atleast it gave you an idea :))

Kakarot
  • 9
  • 1
  • 6
0

You will have to find your own dictionary somewhere. I've used the The Gutenberg Webster's Unabridged Dictionary in the past myself because it's public domain. However, it is in a pretty raw form, and you'll likely have to do a lot of processing on it to get it in a shape that is usable to you.

There are likely other public domain or "open sourced" wordlists somewhere that you can use. I suggest a google search for "public domain english word list" or "free english word list" or similar searches. Then it's just a matter of reading in the file and doing your processing against it.

Daniel
  • 4,481
  • 14
  • 34