Comparing string vs. dictionairy

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Marinusjvv
Forum Commoner
Posts: 29
Joined: Wed Dec 02, 2009 5:59 am

Comparing string vs. dictionairy

Post by Marinusjvv »

Hi.

I'd like to compare a string to be used for a password against a dictionary. Any idea on how to do this?

Thanks
AlanG
Forum Contributor
Posts: 136
Joined: Wed Jun 10, 2009 1:03 am

Re: Comparing string vs. dictionairy

Post by AlanG »

Marinusjvv wrote:Hi.

I'd like to compare a string to be used for a password against a dictionary. Any idea on how to do this?

Thanks
Ah ethical cracking I hope. :) You will need a dictionary file, the code is pretty simplistic.

Code: Select all

 
<?php
$words = file('/path/to/file/' . $dictionaryFile);
 
if(in_array($words, $passGuess)) {
    echo 'Password is :' . $passGuess;
}
else {
    echo 'Password is not in the dictionary file.';
}
?>
 
You will also have to account for case sensitivity. :)
Marinusjvv
Forum Commoner
Posts: 29
Joined: Wed Dec 02, 2009 5:59 am

Re: Comparing string vs. dictionairy

Post by Marinusjvv »

Thanks..

Yes, it's to ensure that users do not use normal words as a password. :)
Any idea where i can download a file to use as a dictionary? i've looked, but can't find..
Post Reply