3. Create the Digest
- Hash the content of the body with
sha256
algorithm using Base64 as output - Concatenate
SHA-256=
and the string of step 1.
Empty body
If your call has no body, create the Digest using an empty string.
{
"flow": "MATCH_CODE",
"amount_unit": 100,
"currency": "EUR"
}
ZML76UQPYzw5yDTmhySnU1S8nmqGde/jhqOG5rpfVSI=
Digest: SHA-256=ZML76UQPYzw5yDTmhySnU1S8nmqGde/jhqOG5rpfVSI=
Code sample 1/4
BODY="{\n \"flow\": \"MATCH_CODE\",\n \"amount_unit\": 100,\n \"currency\": \"EUR\"\n}"
DIGEST="SHA-256="$(echo -e "$BODY\c" | openssl dgst -sha256 -binary | base64)
$body = "{
\"flow\": \"MATCH_CODE\",
\"amount_unit\": 100,
\"currency\": \"EUR\"
}";
$digest = "SHA-256=".base64_encode(hash("sha256", $body, true));
const crypto = require('crypto')
const body = `{
"flow": "MATCH_CODE",
"amount_unit": 100,
"currency": "EUR"
}`
const digest = `SHA-256=`.concat(crypto.createHash('sha256').update(body).digest('base64'))
Digest checker
Tool that allow to check the Digest created. Output from this tool and from your code must be the same.
Updated over 2 years ago