Don’t send unencrypted data from Flash to PHP. I’ve prepared a class that will take a string and convert it to HEX SHA1. It’s fully compatible to compare with PHP sha1(), puts less than 1Kb filesize penalty to your project and is able to iterate through at least 50 calculations a second…
You can download the class file and an example FLA+Document class here (8Kb) (1616 downloads)
Modify, break, sell, copy, steal or improve. If you like it, tell me!


June 10th, 2008 at 10:08 am
fabulous lil piece of AS. I was just randomly glancing through digg and saw this and your name and instantly i remembered you from the gotoandlearnforums. thanks for posting this.
-Lee
June 10th, 2008 at 10:17 am
Thanks man. We all miss GTAL :P
June 12th, 2008 at 1:03 pm
Awesome, will definitely come in useful in a few projects…
Wishing I had more projects to use this specific one with, I enjoy the PHP/Flash projects more…
July 22nd, 2008 at 1:13 pm
Great piece of code… thanks
August 24th, 2008 at 10:03 am
[...] Read more | Source [...]
October 28th, 2008 at 1:10 am
I think your article is misleading. SHA1 creates a Hash and not an encrypted String that can be decrypted on the server-side. It surely is useful for passwords, where you compare the Hash sent by the user with the Hash in the Database. But you can’t use this to send encrypted data from flash to PHP.
January 16th, 2009 at 12:00 am
[...] - bookmarked by 5 members originally found by ILike2MakeWaffles on 2008-12-24 Erik Hallander; Lightweight SHA1 encryption class for Actionscript 3 http://www.erikhallander.com/blog/2008/lightweight-sha1-encryption-class-for-actionscript-3.html - [...]
February 15th, 2009 at 5:03 pm
Thank you! Pretty lightweight class and does just what i need for my AS 3.0 projects. Again, thank you!
May 4th, 2009 at 12:53 am
I would like to ask you to provide the method to decrypt it?
May 14th, 2009 at 8:20 am
I too would be very interested is an AS3 class to decript the string created by your encryption class.
August 5th, 2009 at 9:16 am
@8088
@Fred
SHA1 isn’t an encryption algorithm, but a hashing algorithm. Hashes are called in long form “one way hashes”, which alludes to the fact that it creates a unique numerical value, given any data, and the process does not work in reverse.
August 25th, 2009 at 9:12 am
This is a nice feature for secure applications! Thanks!
January 23rd, 2010 at 2:04 pm
Nice post! GA is also my biggest earning. However, it’s not a much.
rH3uYcBX
March 5th, 2010 at 2:21 pm
Hi guys,
I’m using this online tool to hash with sha1 script.
I wanted to share : sha1 encoder
David