Flex Blog

Search:
  • Home
  • Examples
    • Thumb

      Flex Examples

      Check out our Flex Examples!

    • Thumb

      Flash Builder Examples

      Check out our Flash Builder Examples!

    • Thumb

      AIR Examples

      Check out our AIR Examples!

    • Thumb

      Flex Mobile Examples

      Check out our Flex Mobile Examples!

    Adobe® Flex, Adobe® Flash Builder and Adobe® AIR are registered trademarks of Adobe Systems.
  • Components
    • Thumb

      WP Flex Contact Form

      Check out our WP Flex Contact Form!

    • Thumb

      Flash CountDown Plugin

      Check out our Flash CountDown Plugin!

    This is an overview of all our Flash/Flex based Components.
  • Jobs
  • Flex Books
  • Forum
  • Contact Us
Subscribe to Flex BlogSubscribe
  • Examples
  • iOS
Browse > Home / Examples / Flex Encryption (MD5, SHA1, SHA224, SHA256, HMAC)

Flex Encryption (MD5, SHA1, SHA224, SHA256, HMAC)

21 June 2010

Line Break

Author: Janez Feldin (6 Articles) - Author Website

Janez likes to experiment with flash in his own free time. His other hobbies are playing volleyball, listening to the music, watching movies and above all else, paragliding.

After a question on our flex forum about MD5 encryption, I decided to write an example about all the encryption types available in Flex.

Encryption is not available by default, you have to download the latest version of the (open source) project AS3corelib.

If you would like to encrypt a String with an MD5, you have the MD5 class in as3corelib-.92.1srccomadobecryptoMD5.as.

Import this class and than just call

1
MD5.hash("some string");

and there you go…

To show you every encryption method I’ve written this example.

Janez

No related posts.

Written by Janez Feldin · Filed Under Examples 

Was this post useful to you?

Please rate this post, follow us @ twitter, or link to this page from your website!

1 Star2 Stars3 Stars4 Stars5 Stars (8 votes, average: 4.25 out of 5)
Loading ... Loading ...

e4455083e5511c726570c94a4faa22c7delicious

Comments

6 Responses to “Flex Encryption (MD5, SHA1, SHA224, SHA256, HMAC)”

  1. dwaves.de on June 27th, 2010 11:45 am

    thanks pal for this example!

    i just tried to check how mysql is encrypting its passwords
    SELECT PASSWORD(‘asdfjkl123!’); -> *3CE6C81118685E32AA2EC54A61DDA51CC4B9AA94

    but none of the functions above seem to match that.

    do you know why?

    best regards!

  2. Janez Feldin on June 29th, 2010 4:17 pm

    If none of the above methods match than its most likely that mysql uses some other encryption method.

    I think you could find your answer if you go in mysql documentation and search what method mysql uses and than try to find the right class for flex to encrypt with the same method

  3. oliver on February 7th, 2011 11:47 pm

    how do you use the as3corelib to generate md5s of a file??
    need to get a local file and generate an md5 – please there are no tuts on the net for this subject

    thanks

  4. Janez Feldin on February 8th, 2011 10:54 pm

    If you want to encode something with md5 you will need to have a string, so to represent a file with a string simply load it with URLLoader:

    Here is the code to acctualy load the file:

    1
    2
    3
    var loader:URLLoader = new URLLoader();
    loader.addEventListener(Event.COMPLETE, fileLoaded);
    loader.load(new URLRequest("path_to_your_file"));

    and the function that gets called when your file is fully loaded:

    1
    2
    3
    4
    5
    private function fileLoaded(e:Event):void
    {
    var file_string:String = e.target.data;
    //so this "file_string" is now the string you want to encode with md5
    }

    Hope this helps…
    Regards

  5. Chris on August 30th, 2011 1:13 am

    The title is confusing. MD5 is not an encryption method, but a Hash.

  6. Janez Feldin on August 30th, 2011 10:36 am

    Actually only HMAC is an encryption (I think), all others are Hash :)

Get Adobe Flash player

  • +1?

  • Support Flex Blog!

  • $ 13 raised
    • 2012/01/13 8:22 PM Russell Brown donated $ 3.00
    • 2011/10/31 4:43 PM Steve Dakin donated $ 5.00
    • 2011/05/11 3:37 PM Roelof Albers donated $ 5.00
  • Stay in touch!

  • Popular Tags

    • AdvancedDataGrid
    • AIR
    • ArrayCollection
    • baseColor
    • Button
    • CursorManager
    • DataGrid
    • Dynamic
    • Effects
    • File
    • FileStream
    • Flash Builder
    • Flash Builder 4
    • Flex 4
    • Flex Mobile
    • Framework
    • Icon
    • Image
    • itemRenderer
    • LinkBar
    • Mobile
    • PHP
    • ProgressBar
    • Repeater
    • Style
    • SWIZ
    • Timer
    • Tree
    • Twitter
    • ViewStack
  • Advertisements

  • Recent Posts

    • Spooky Frenzy – iPad Game
    • Fountain Example
    • Reading & Writing files in Adobe AIR
    • CheckBox in List using MobileIconItemRenderer for Flex Mobile
    • Data Dependent decoratorClass in MobileIconItemRenderer Example
    • Flex 4 Resize Effect Example
    • Jump to next field using the Focus Manager
    • Searching Data using a Class Example
    • Flex Mobile: Two finger tap gesture to toggle actionBar visibility in a View (AIR for Android)
    • TabbedMobileApplication Example in Flex Mobile (AIR for Android)
  • Categories

    • Examples
    • Guest Poster
    • iOS
  • Archives

    • September 2011
    • July 2011
    • May 2011
    • March 2011
    • February 2011
    • November 2010
    • October 2010
    • September 2010
    • August 2010
    • June 2010
    • May 2010
    • April 2010
    • March 2010
    • February 2010
    • January 2010
    • December 2009
    • November 2009
    • October 2009
    • March 2009
    • February 2009
  • Blogroll

    • Adobe Flex Jobs
    • NL for Business
  • Meta

    • Register
    • Log in
    • WordPress
    • XHTML

Copyright © 2010 Flex Blog · Adobe® and Adobe® Flex are registered trademarks of Adobe Systems.

WordPress Adobe Flex Adobe Flash Builder Adobe AIR Creative Commons License

  • Popular Posts

    • Progressbar in Datagrid Example 13 votes, average: 5.00 out of 513 votes, average: 5.00 out of 513 votes, average: 5.00 out of 513 votes, average: 5.00 out of 513 votes, average: 5.00 out of 5 (5.00 out of 5)
    • Data Dependant Tree Icon with Tree in AdvancedDataGrid with iconFunction 8 votes, average: 5.00 out of 58 votes, average: 5.00 out of 58 votes, average: 5.00 out of 58 votes, average: 5.00 out of 58 votes, average: 5.00 out of 5 (5.00 out of 5)
    • List Directory with AIR in Flex 4 7 votes, average: 5.00 out of 57 votes, average: 5.00 out of 57 votes, average: 5.00 out of 57 votes, average: 5.00 out of 57 votes, average: 5.00 out of 5 (5.00 out of 5)
    • Flex FlashVars in AS3 Example 7 votes, average: 5.00 out of 57 votes, average: 5.00 out of 57 votes, average: 5.00 out of 57 votes, average: 5.00 out of 57 votes, average: 5.00 out of 5 (5.00 out of 5)
    • Flex Dynamic Chart Example 4 votes, average: 5.00 out of 54 votes, average: 5.00 out of 54 votes, average: 5.00 out of 54 votes, average: 5.00 out of 54 votes, average: 5.00 out of 5 (5.00 out of 5)