![]() |
password encrypt algorithm.
Hi ppl..
the password encrypt is a public algorithm?? not is MD5... somebody knows that algorithm is ...? this question came to my mind, when i change asp to php ;) thx |
Code:
function encrypt($str) { |
Actually it's wrong, and as I see noone ever noticed that... :P As some of you know this function was sometimes returning wrong hash (too long, and with wrong data).
Problem is that someone put /65535 instead of /65536 and after that all people were using it without checking. Those are correct lines: Code:
$key[3] = intval(($one - $key[4] * 16777216) / 65536);Wrong code is for example used in: https://postpacific.loc-online.com/f...hlight=encrypt https://postpacific.loc-online.com/f...hlight=encrypt https://postpacific.loc-online.com/f...hlight=encrypt L2Tools 1.6 L2Control Panel. |
Thanks, but one question.
I changed this string's and still have problem. Look, I have made hash of password ROOT and ROOD. And they was same! 0xb1be70e9a83f19192cb593935ec4e2e2 Im think that's abnormal, any idea? |
Same hash for simmilar words is an other thing, it's dependant on algorith, which is just not perfect itself, so it's 'normal'. Blame NCsoft programmers for that. At least implementation is correct now :P
|
Has understood, good job.
thanks. |
Even with ateh's correction, I can't log on my server with L2CP.
Accounts had been made by L2 account creator. If anyone have an idea, because I need to make something like UPDATE user_auth SET password = blabla WHERE password=blibli AND account = bla. thanks :) |
My slightly changed (simplified) version:
Code:
function password_encrypt ( $plain ) {PHP Code:
|
Kenjiro, that's cool.
Big thanks, +1. I will test. |
Just tested, and it works great!
thank you a lot! |
In fact... it works great but only with passwords without numbers :/
The encryption of number is wrong so people can't play if they enter a password with numbers in it. |
my implementation
Code:
|
What is the difference between function on L2CP and this 2 functions ? :happy4:
|
my function is resist for errors (max chars 16).
|
Thank's a lot :)
It seems this works with numbers too :) |
Hmm, mine is tested with a-zA-Z0-9!@#$%^&*()-_=+[]{}\|;':",./<>? and working, and... why shouldn't? It is mathematically the same as l2asp version (but ASP was lowercasing letters which was a bit annoying).
|
I really don't know, but every people on my server with numbers in their password had problem :(
|
Which version are U using before? Mine and adriahu versions is essentially the same (minor coding styles and array offset).
|
First I used some version found on this forum and the code in L2CP, then your's but with problems with numbers, and now, adriahu's one, without problems.
|
I'd personally exchange:
Code:
$nBytes = strlen($str);Code:
while ($i < 16) {If you don't do this there will be $key's that will remain "undefined". If you have error_reporting on E_ALL you will have a few warnings. If you exchange that part with my code those warnings will be gone + will work fine. |
Yes, you're right, all variables should be initialized before use, thus in my version is:
PHP Code:
PHP Code:
|
| All times are GMT. The time now is 15:17. |