Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MD5

Status
Not open for further replies.

apatterno

Programmer
Nov 26, 2002
368
US
Does anyone know if there are any Actionscript implementations of the MD5 algorithm out there? Using Flash MX.

Thanks
Will
 
There's a Javascript implementation of the algorithm here:


...which you should be able to convert to actionScript as they are broadly similar languages but it may be easier to do the encrypting serverside with PHP (where the function is built-in and very quick) and return the encrypted string to Flash although this does raise security issues I suppose.
 
Thanks for the link! I will look into it.

I am doing this to make a flash game, and when the game is over, it sends some variables to a PHP script that tracks High Scores. The problem with that is that anyone can type into their browser highscore.php?s=999999999&n=Hacker and cheat the system.

I was thinking I could also pass an MD5-encrypted string which includes the person's score along with a secret word. For example, the MD5 of "10720jenson". That gets sent as highscore.php?s=10720&n=Legit%20Player&k=3cc4c497248830887bd731f967fbe2cf. The PHP script verifies that the score claimed is in accord with the MD5 sum. I think that works because nobody knows how to generate the proper MD5 sum, since they don't know the secret word.

But thanks for the algorithm!
 
I have a question about Flash strings and the JavaScript code

Code:
var chrsz   = 8;  /* bits per input character. 8 - ASCII; 16 - Unicode      */

Does Flash use Unicode or ASCII? In the help files, it claims to use Unicode, but in my experience whenever I paste Unicode text into the ActionScript window, all I get is a bunch of question marks.
 
That seems like overkill to me. Sending the variables via loadVars() and 'POST' instead of 'GET' means that they can't type a query string like the one you demonstrated - they won't see the values being passed so can't cheat.
 
Unicode settings are controlled by System.useCodePage which toggles between local and full unicode settings - set to true or false depending on what you want to use.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top