Convert string to bytes
(Adding message template to the top of the page)
(Replacing message template with parser tag)
Line 1: Line 1:
{{message|Write the content here to display this box}}
<message>Write the content here to display this box</message>
To convert a string to a UTF8 byte array (a blob), do this:
To convert a string to a UTF8 byte array (a blob), do this:
  orgdata.StringToBase64.Base64ToBlob
  orgdata.StringToBase64.Base64ToBlob

Revision as of 07:40, 17 June 2024

This page was created by Hans.karlsen@mdriven.net on 2022-03-21. Last edited by Edgar on 2025-01-20.

To convert a string to a UTF8 byte array (a blob), do this:

orgdata.StringToBase64.Base64ToBlob

Here is an example of how to calculate a complex token for Svea-pay:

-- as defined in https://checkoutapistage.svea.com/docs/#/getting-started
let orgdata=requestbody+SveaSettingsSingleton.oclSingleton.MerchantSecret+timestamp in
(
  let thehash=SysSingleton.oclSingleton.SHA512ComputeHash(orgdata.StringToBase64.Base64ToBlob) in
  (
    (SveaSettingsSingleton.oclSingleton.MerchantId+':'+SysSingleton.oclSingleton.BitConverterToString( thehash ).Replace('-','')).StringToBase64
  )
)