Page 1 of 1

Trying to redo the l2j password encryption in flash website

Posted: Sat Jul 20, 2013 12:05 am
by Bliss
Hello! I want my users to be able to log on my flash website, so I need to reproduce the l2j login password encryption on actionscript 3 (Is there maybe an easier way?)

So I found this code on LoginController.java

Code: Select all

            MessageDigest md = MessageDigest.getInstance("SHA");            byte[] raw = password.getBytes("UTF-8");            byte[] hash = md.digest(raw); 
and below another encryption to base64 (Im not sure if Im missing another encryption)

I made this code for actionscript 3

Code: Select all

         Login_Usuario.Texto_Usuario.text = encodeUTF8 (Login_Usuario.Texto_Usuario.text);        Login_Usuario.Texto_Usuario.text = SHA1.hash (Login_Usuario.Texto_Usuario.text);        Login_Usuario.Texto_Usuario.text = Base64.encode(Login_Usuario.Texto_Usuario.text); 
But I'm not getting the same results, I think that has something to do with the UTF8 encoding, which is probably not an encryption:

Code: Select all

function encodeUTF8 (text:String):String {    var a:uint, n:uint, A:uint;    var utf:String;    utf = "";    A = text.length;     for (a = 0; a < A; a++) {        n = text.charCodeAt (a);        if (n < 128) {            utf += String.fromCharCode (n);        } else if ((n > 127) && (n < 2048)) {            utf += String.fromCharCode ((n >> 6) | 192);            utf += String.fromCharCode ((n & 63) | 128);        } else {            utf += String.fromCharCode ((n >> 12) | 224);            utf += String.fromCharCode (((n >> 6) & 63) | 128);            utf += String.fromCharCode ((n & 63) | 128);        }    }    return utf;}
Does anyone knows how to do that on AS3, or an easy way to do it?

Thx a lot

Re: Trying to redo the l2j password encryption in flash webs

Posted: Sat Jul 20, 2013 9:27 am
by jurchiks
Why would you even want that to be on the client-side? Its a bad idea, flash is easy to decrypt, lots of tools around for that, any interested and at least slightly experienced person will be able to get your stuff.

Re: Trying to redo the l2j password encryption in flash webs

Posted: Sat Jul 20, 2013 11:58 am
by Bliss
So what do you suggest? Is calling a php script from the flash website secure?