Permission is granted to reprint/use these on the web so long as there is a link to my website.
An Easy Way to Generate a Strong password(2007)
The strength of passwords is becoming more important these days, as the means to do dictionary and brute force attacks becomes easier on faster processors. Using a long password might help but being able to remember it exactly and type it without mistakes is less likely as the password length grows.
One method of generating a long password, without storing it anywhere is to select a file (either binary or text), do a little bit of processing on it then force the resulting values into the ASCII range 32-127 and output them as characters. It sounds complex but it isn't. The attached program generates 80 character passwords and copies them to the clipboard.
Download this zip file. This has an exe (compiled on a Virus free PC), with full source code compileable with Delphi 4+. You don't need the source code to use this. You can find a C# version of this here.
How to Use It
Run sp.exe. It will show this form
Click the Select File button and browse until you find a file. Press Ok. If it loads it correctly you should see the size, just to the right of the word "Offset" and the Generate button will become clickable. When you click it, you should see a very long password under the word "Password". This is copied to the clipboard automatically and you can then paste it into a password field etc.
The optional Modifer button lets you type in any string. this is repeatedly used to mask the bytes. You can also (optionally) select an offset into the selected file. This gives you different passwords as well. You will always get the same password for the same file, modifier and offset values. Remembering those three values, or just the filename if you accept the default blank modifer and 0 offset values is far easier than the very long password it generates.
How It Works
The file is read into a TstringStream variable s (using a TfileStream). If an non zero offset is specified then the bytes start at the specified offset. After reading, the byte length is trimmed to 80 characters.
It then iterates through every character in the string, 'and'ing it with $7f (127) to clear the top bit and 'or'ing with a byte from the modifier string. If the resulting value is below 32 then it is ored with 32 to make it a printable character. After that it is copied to the Password string and then that is copied to the clipboard.