0

in PHP I have this code to convert a string to binary and encode to Base 64:

    <?php
$value = pack('H*', "b4h3h347h38f3g734ff");
echo base64_encode($value);

But how I can do that in Javascript ?

Thank you!

zZPrank
  • 1
  • 3

1 Answers1

0

See text_to_binary here in SO.

Use btoa() and atob() to convert to and from base64 encoding.

Community
  • 1
  • 1
tale852150
  • 1,558
  • 3
  • 16
  • 22
  • I tried that method but when I compare the result of PHP and Javascript, it is totally different – zZPrank May 21 '17 at 03:45