• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Password
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Password


  • Subject: Re: Password
  • From: Barry Wainwright <email@hidden>
  • Date: Sat, 19 Sep 2009 12:05:57 +0100



On 2009-09-18, at 23:39:18, Jarrod Coffin wrote:

Hello i started out making a simple app that would show hidden files but as i thought about it I dont want just anyone being able to access this app with out a password. I have most of the script but its not compiling right and i cant figure out why. Im also pretty new to this.

here is the script i have already:

[Snip]...

set the_password to "password" --set this to the password you want to use



It is worth pointing out that it is very bad practice to store the password in the script itself. The password can be easily read from the script files - even if the script is stored as 'run-only'

A far better technique is to store a MD5 hash of the actual password and pass the user's input to the shell to check the hash matches:

property passwordHash : "5f4dcc3b5aa765d61d8327deb882cf99"

repeat
display dialog "please enter password" default answer "password" buttons {"Cancel", "OK"} default button 2 with icon 0 with hidden answer
set userInput to text returned of the result
set userHash to last word of (do shell script "md5 -s \"" & userInput & "\"")
if userHash = passwordHash then
display dialog "You Guessed right!"
exit repeat
else
display dialog "Wrong! Try again..."
end if
end repeat


to get the hash in the first place, open the terminal and type:

md5 -s "your password phrase"

the hash will be displayed on the following line

-- 
Barry

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

References: 
 >Password (From: Jarrod Coffin <email@hidden>)
 >Re: Password (From: Philip Aker <email@hidden>)

  • Prev by Date: Re: Applescript Editor preferences
  • Next by Date: Re: Mail scripting
  • Previous by thread: Re: Password
  • Next by thread: Re: Password
  • Index(es):
    • Date
    • Thread