Flex MD5 / SHA1-256 Password encoder


I build a lot of Flex Applications on PhP / MySQL Backends. Now these PhP backends most of the time check if the users has the correct rights for e.g. opening a database or getting some data or what ever.

When a new user of the Flex or AIR application want’s to change their password or create a new user with password I triggerd a nice little php password create script that makes a nice MD5 (with salt) password out of the given readable password.

But this is actually an extra step in the process I don’t want. Wouldn’t it be great if Flex could create this MD5 password with or without salt ?

Or even better, what if Flex could create a MD5, SHA1, SHA-256 password with or without salt out of the given readable password ?


Now it is possible with this simple to use script:


Encryption.encrypt(strPW, EncType, Salt, SaltNr);

Actually Adobe already have a class that does all the work for you. It’s the Crypto classes (MD5.as / SHA1.as) that you have to use together with the utils class (IntUtil.as) that makes this all possible.

The nice thing about this is, that it supports the same encryption as PhP, so no matter if you create it in PhP or in Flex, the outcome is always the same. And comparing them from Flex to PhP or visa versa will garantuee a correct outcome.

Have fun !


You can download it here .

Theo van der Sluijs

Theo van der Sluijs (1975) is Software Development Manager at Bax-shop.nl. You can read more in dutch on his “Dutch Blog“, he also created Gebruikmaar.nl. He is a member of the Board of the Dutch Flex Usergroup and Goesweb.net.

Google+ Twitter LinkedIn 



VN:F [1.9.13_1145]
Rating: 7.6/10 (13 votes cast)
VN:F [1.9.13_1145]
Rating: +2 (from 4 votes)
Flex MD5 / SHA1-256 Password encoder, 7.6 out of 10 based on 13 ratings

Related Posts

11 comments

  1. JCRocks

    Thanks for the example. However, the source is not available via right click.

    VA:F [1.9.13_1145]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.13_1145]
    Rating: +1 (from 1 vote)
  2. Argh. The one thing I've been having a massive problem with and I can't see how you're able to get around it because your "View Source" isn't enabled.

    VA:F [1.9.13_1145]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.13_1145]
    Rating: 0 (from 0 votes)
  3. OOOOO… finally got it. Thanks for helping me find that it was at least possible!

    VA:F [1.9.13_1145]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.13_1145]
    Rating: 0 (from 0 votes)
  4. Where is the source?

    VA:F [1.9.13_1145]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.13_1145]
    Rating: 0 (from 0 votes)
  5. This is really interesting, when can we expect the source?

    VA:F [1.9.13_1145]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.13_1145]
    Rating: 0 (from 0 votes)
  6. Curious do you have an example for the php side of this that is compatible?

    Thanks!

    VA:F [1.9.13_1145]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.13_1145]
    Rating: 0 (from 0 votes)
  7. import com.tvds.*;

    Hmm!! can you clarify this if possible

    VA:F [1.9.13_1145]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.13_1145]
    Rating: 0 (from 0 votes)
  8. What lib do I need to import?

    VA:F [1.9.13_1145]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.13_1145]
    Rating: 0 (from 0 votes)

Leave a Reply

Get Adobe Flash playerPlugin by wpburn.com wordpress themes