You may know this, but, "salting" a password is the technique of putting a completely obvious but mostly unique phrase into the password so that an attacker must specifically attack each individual rather than allowing him to attack everyone at the same time by creating a brute-force dictionary for all combinations. At the same time this additional data is chosen to be very easy to remember. For example, the passphrase "thezerg hello world" is much harder than just "hello world". I think NoBrainr could benefit from salting.
def main(salt=None):
if salt: salt = salt + " "
else: salt = ""
f = open('DICT')
if len(sys.argv)>1:
wd = dict(x.split() for x in f)
pp = salt + ' '.join([wd
- for x in sys.argv[1:16]])
else:
wd = [x.strip('\n') for x in f]
pp = salt + ' '.join([wd[random.SystemRandom().randrange(0,len(wd))][6:] for _ in range(7)])
pr = S(pp).hexdigest()
print addr(int(pr,16)),'==',pp
Thanks for your contribution. In general, I'm all for salting, but it mostly helps protect _weaker_ (human-chosen) passwords against "en masse" cracking. As the passphrases we are generating here are all
equally strong (90+ bits, or much more if you are comfortable with remembering longer passphrases),
I think that salting wouldn't bring that much additional benefit _in this context_.
Also you could simply generate passphrases with one more word - just by changing range(7) into range(
-
and think of the first word as the salt... You can even allow yourself to cherrypick it (generate passphrase upon passphrase until you get a first word that you like), since it is your "salt."
Most words in the NoBrainr wordlist can be described as "completely obvious" anyway.
And I'm constantly improving the wordlist (by replacing the less common and offensive words.)
Edit: Hmm not sure how to avoid that emoticon... read: range ( 8 )