Trying to redo the l2j password encryption in flash website

This is not a Support area! Discuss about the Server here. Non-Server related discussion goes in Off-Topic Discussion.
Forum rules
READ NOW: L2j Forums Rules of Conduct
Post Reply
Bliss
Posts: 8
Joined: Sat May 21, 2011 4:28 pm

Trying to redo the l2j password encryption in flash website

Post 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
User avatar
jurchiks
Posts: 6769
Joined: Sat Sep 19, 2009 4:16 pm
Location: Eastern Europe

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

Post 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.
If you have problems, FIRST TRY SOLVING THEM YOURSELF, and if you get errors, TRY TO ANALYZE THEM, and ONLY if you can't help it, THEN ask here.
Otherwise you will never learn anything if all you do is copy-paste!
Discussion breeds innovation.
Bliss
Posts: 8
Joined: Sat May 21, 2011 4:28 pm

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

Post by Bliss »

So what do you suggest? Is calling a php script from the flash website secure?
Post Reply