• 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: string literals passwords in run only applications
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: string literals passwords in run only applications


  • Subject: Re: string literals passwords in run only applications
  • From: Arthur J Knapp <email@hidden>
  • Date: Wed, 27 Feb 2002 18:13:59 -0500

> Date: Wed, 27 Feb 2002 00:48:39 -0500
> From: email@hidden
> Subject: Re: string literals passwords in run only applications


> But as I posted a little while ago, Akua's 'encrypt' has some deficiencies
> that
> make it poor as the basis for a hash function.

Right, encrypting and hashing are not always the same thing. Each
previous hash should contribute and modify the next hash. This is
a port and modification of a hashing function from Robert Sedgewick's
"Algorithms in C, Third Edition, Parts 1-4":


on UniversalHash(str, max_prime_num)

set n1 to 31415 --> repeatedly modify the hash
set n2 to 27183 --> repeatedly modify n1

set hash_num to 0 --> we're obtaining a numerical hash

repeat with c in str

set n to ASCII number c --> this slows things up, of course

set hash_num to ((n1 * hash_num) + n) mod max_prime_num

set n1 to (n1 * n2) mod (max_prime_num - 1)

end repeat

return (hash_num as integer)

end UniversalHash

-- password, prime num --> compare in script
--
UniversalHash( "ABC", 19997) --> 11842
UniversalHash( "BBC", 19997) --> 4801
UniversalHash( "CBC", 19997) --> 17757



{ Arthur J. Knapp, of <http://www.STELLARViSIONs.com>
<mailto:email@hidden>
try
<http://homepage.mac.com/ewalet/DeskTop.html>
on error number -128
end try
}
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: Anyone working with Quark in OSX and getting good results of fonts size?
  • Next by Date: Re: Unexpected negativity
  • Previous by thread: Re: string literals passwords in run only applications
  • Next by thread: Quark error -48
  • Index(es):
    • Date
    • Thread