E
E
Evgeny Strashko2015-06-20 20:54:11
PHP
Evgeny Strashko, 2015-06-20 20:54:11

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

1 answer(s)
E
Evgeny Strashko, 2015-06-20
@jonny_don

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 question

Ask a Question

731 491 924 answers to any question