As a part of a system-wide AI script (Why and I doing this in applescript? Nevermind…) I have a password system. It takes:
¢ the ‘name’ of a website (e.g. macscripter)
¢ a user set password string (e.g. mysuperpassword) which can be used on all sites
¢ a password length (default 10)
and scrambles it all together beautifully, adding in at least one £ sign in the front (password breakers tend to ignore foreign currency symbols) and tries to reach the number of characters.
The result is using one memorable password to generate a secure, different password for each website which you don’t need to remember. Just use the script to get the password back because it’ll give the same answer each time.
Finally it copies your password to the clipboard to be pasted into a password box and after 5 seconds clears the clipboard to stop someone pasting it into a text document or something and discovering it.
set input to the text returned of (display dialog "Site name:" default answer "" buttons {"OK"} default button 1)
set secCode to the text returned of (display dialog "Security code:" default answer "" buttons {"OK"} default button 1 with hidden answer)
set totlength to the text returned of (display dialog "Password length:" default answer "10" buttons {"OK"} default button 1) as number
set timeunit to (round ((hours of (current date)) / 6) rounding down) + 1
set sLetterSet to {"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"}
set cLetterSet to {"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"}
set numberSet to {"2", "6", "8", "0", "7", "4", "5", "7", "0", "1", "0", "9", "5", "7", "6", "2", "9", "8", "4", "5", "1", "3", "2", "3", "8", "4"}
set specialSet to {"!", "$", "%", "£", "^", "&", "*", ")", "-", "+", "=", "[", "{", ";", "'", ":", "|", ",", ".", "/", "?", "<", "±", "§", "`", "~"}
set totlength to totlength - 1
set finNum to 0
repeat with i from 1 to the number of characters in input
set finNum to finNum + (ASCII number (character i of input))
end repeat
repeat
if finNum > 40 then
set finNum to finNum - 40
else
exit repeat
end if
end repeat
set pusher to sLetterSet & cLetterSet & numberSet & specialSet as text
set worker to ""
repeat with i from 1 to the number of characters in input
set pos to ((offset of (character i of input) in pusher) + finNum * i * i)
repeat
if pos > 104 then
set pos to pos - 104
else
exit repeat
end if
end repeat
set worker to worker & character pos of pusher
end repeat
set input to worker
set finNum to 0
repeat with i from 1 to the number of characters in secCode
set finNum to finNum + (ASCII number (character i of secCode))
end repeat
repeat
if finNum > 40 then
set finNum to finNum - 40
else
exit repeat
end if
end repeat
set worker to ""
repeat with i from 1 to the number of characters in secCode
set pos to ((offset of (character i of secCode) in pusher) + finNum * i * i)
repeat
if pos > 104 then
set pos to pos - 104
else
exit repeat
end if
end repeat
set worker to worker & character pos of pusher
end repeat
set secCode to worker
set worker to ""
repeat with i from 1 to the number of characters in input
set pos to ((offset of (character i of input) in pusher) + finNum * i * i)
repeat
if pos > 104 then
set pos to pos - 104
else
exit repeat
end if
end repeat
set worker to worker & character pos of pusher
end repeat
set input to worker
set finpw to ""
if the number of characters in input > the number of characters in secCode then
repeat with i from 1 to the number of characters in secCode
set numToPush to (offset of (character i of secCode) in pusher) + (offset of (character i of input) in pusher)
repeat
if numToPush > 104 then
set numToPush to numToPush - 104
else
exit repeat
end if
end repeat
set finpw to finpw & character numToPush of pusher
end repeat
else
repeat with i from 1 to the number of characters in input
set numToPush to (offset of (character i of secCode) in pusher) + (offset of (character i of input) in pusher)
repeat
if numToPush > 104 then
set numToPush to numToPush - 104
else
exit repeat
end if
end repeat
set finpw to finpw & character numToPush of pusher
end repeat
end if
if the number of characters in finpw > totlength then
set worker to finpw
set finpw to ""
repeat with i from 1 to totlength
set finpw to finpw & character i of worker
end repeat
else if the number of characters in finpw < totlength then
set finpw to finpw & input & secCode
if the number of characters in finpw < totlength then
set finpw to finpw & input & secCode & (specialSet) as text
end if
set worker to finpw
set finpw to ""
repeat with i from 1 to totlength
set finpw to finpw & character i of worker
end repeat
end if
set finpw to "£" & finpw
set the clipboard to finpw
beep 2
delay 5
if (the clipboard) is finpw then
set the clipboard to ""
end if
beep 2
Also… I’ve posted the code here. So if your (or my) laptop dies, you can get the passwords back!
Model: MacBook
AppleScript: 2.3
Browser: Google Chrome
Operating System: Mac OS X (10.6)