[LoginController] Create new character.
Posted: Wed Jul 13, 2016 10:05 am
In the past I used simple php script for registration my users.
But now I can find new part of code in retriveAccountInfo:
I read about these functions in google and guess some about how l2j create accounts. But... When I count bytes(summ bytes each of arrays' elements) of string(password) and then encode this value into SHA, then in Base64, I can't get correct result.
Example:
but password string from php not equals same password string in db (really password is equals)
P.S. find method how I can do it. But I dont fully understand how it works in J.
But now I can find new part of code in retriveAccountInfo:
Code: Select all
MessageDigest md = MessageDigest.getInstance("SHA");
byte[] raw = password.getBytes(StandardCharsets.UTF_8);
String hashBase64 = Base64.getEncoder().encodeToString(md.digest(raw));
Example:
Code: Select all
$byte;
$bytes = array();
for($i = 0; $i < strlen($pwd); $i++){
$bytes[] = ord($pwd[$i]);
$byte += ord($pwd[$i]);
}
print_r($bytes);
Code: Select all
const char[] password = Base64(SHA($byte)); // This's example, not php method
P.S. find method how I can do it. But I dont fully understand how it works in J.
Code: Select all
var_dump( base64_encode( pack( 'H*', sha1( $pwd ) ) ) ); // PHP