3

I'm trying to connect to PayBox payment service. They propose a PHP solution, but I'm using Nodejs. In their solution they use PHP pack function of which I can't find an equivalent in Node.js.

This is the target:

$binKey = pack("H*", $secretKeyTest);

I found a package Hipack but it has couple of issues.

1
  • So did my answer help you? Commented Nov 22, 2016 at 15:51

1 Answer 1

5

If you need to convert a hexadecimal string into a binary buffer, then something like this may work for you:

var binKey =  Buffer.from(secretKeyTest, "hex");

For more info on how to use buffers in Node, see:

Sign up to request clarification or add additional context in comments.

3 Comments

Yes it did Thanks a lot :)
I have the code new Buffer(salt, "base64") and I want to convert it into PHP. Do you have any solution? please help me.
Hi @ManishJangir, bit late try this function base64_encode(string $string): string

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.