I have to hash the password for using an API with authentication. the code snippet for hashing is in the documentation, which is as follows:
$password = "[".implode(',',unpack('C*', hash('sha512', $pwd, true)))."]";
the code snippet return something like "[1,2,3,4,5,6,7]"
I put the password to an object (the class implements \JsonSerializable)
$apiCall->setPassword($password);
but when i json_encode the object, i got the password like this:
"Password":"[149,239,56,211,172,179,...]"
the problem is the quotation mark ". How can i remove, and pass the password to $apiCall as array, and not as string?
"Password": [149,239,56,211,172,179,...]
UPDATE Why don't I use the simply the unpack result, which is an array?
$password = unpack('C*', hash('sha512', $pass, true));
and after json_encode the password will be
"Password":{"1":149,"2":239,"3":56,"4":211,"5":172,..}"
but I need the format described a few lines above.