Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert SHA1 to base64

Tags:

php

can someone help with this thing that is driving me crazy? on https://tomeko.net/online_tools/hex_to_base64.php?lang=en and https://base64.guru/converter/encode/hex

I want to get this output on my PHP script like the above sites----->afE/gGTQDVy64Mres5m26KbDMU4=

$str = '69F13F8064D00D5CBAE0CADEB399B6E8A6C3314E';
echo base64_encode($str);

but my output is-------->

NjlGMTNGODA2NEQwMEQ1Q0JBRTBDQURFQjM5OUI2RThBNkMzMzE0RQ==
like image 207
Abu Enejoh Christopher Avatar asked Oct 12 '25 10:10

Abu Enejoh Christopher


1 Answers

Does echo base64_encode(hex2bin('69F13F8064D00D5CBAE0CADEB399B6E8A6C3314E')); work for you?

I tested this here http://sandbox.onlinephpfunctions.com/code/9715207a2edbf15ca54c89cbf9c79559bcfcd76e

like image 198
AaronJ Avatar answered Oct 14 '25 07:10

AaronJ