Answer the question
In order to leave comments, you need to log in
What is the correct way to use base64_encode in php?
Hello. I am writing a payment module and there was a problem - the data is not encoded correctly.
$sha1_data = "5a290965f80e07c814937f221635a645dbcca336";
$data = hex2bin("$sha1_data");
$signature = base64_encode($data);
At the output I get
$signature = "WikJZfgOB8gUk38iFjWmRdvMozY=".
And it should be:
$signature = "WikJZe+/vQ4H77+9FO+/vX8iFjXvv71F77+9zKM2" Tell me
what's wrong?
Answer the question
In order to leave comments, you need to log in
Firstly, when decrypted, it does not match the original data, and secondly, if the contents of $data are encrypted, for example, on base64.ru, we get: WikJZe+/vQ4H77+9FO+/vX8iFjXvv71F77+9zKM2, which, when decrypted, matches $data
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question