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 .

About the author

Theo van der Sluijs Theo van der Sluijs (1975) is Lead Developer at Unitrust BV. He is also creator of "I Am Bored So I blog" / Gebruikmaar.nl / vanderSluijs.nl. He is a member of the Board of the Dutch Flex Usergroup and Goesweb.net. With his quote "Never Give Up, Never Surrender" (Actually stolen from Galaxy Quest) he fights his way through the day. Connect with him on Twitter.

VN:F [1.9.3_1094]
Rating: 6.5/10 (8 votes cast)
VN:F [1.9.3_1094]
Rating: +1 (from 3 votes)
Flex MD5 / SHA1-256 Password encoder, 6.5 out of 10 based on 8 ratings

9 Responses to “Flex MD5 / SHA1-256 Password encoder”

  • JCRocks:

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

    VA:F [1.9.3_1094]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.3_1094]
    Rating: +1 (from 1 vote)
  • Doug:

    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.3_1094]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.3_1094]
    Rating: 0 (from 0 votes)
  • Doug:

    OOOOO… finally got it. Thanks for helping me find that it was at least possible!

    VA:F [1.9.3_1094]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.3_1094]
    Rating: 0 (from 0 votes)
  • Chad:

    Where is the source?

    VA:F [1.9.3_1094]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.3_1094]
    Rating: 0 (from 0 votes)
  • David:

    This is really interesting, when can we expect the source?

    VA:F [1.9.3_1094]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.3_1094]
    Rating: 0 (from 0 votes)
  • Joe:

    Curious do you have an example for the php side of this that is compatible?

    Thanks!

    VA:F [1.9.3_1094]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.3_1094]
    Rating: 0 (from 0 votes)

Leave a Reply

QR Code
Donate

Like the information on my site? Please donate for a cup of coffee, or give a bit more for a cappuccino.

Twitter
Get Adobe Flash playerPlugin by wpburn.com wordpress themes