Convert string to bytes
No edit summary
(Automatically adding template at the end of the page.)
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
When you need to convert a string to a UTF8 byte array (a blob) go like this:
To convert a string to a UTF8 byte array (a blob), do this:
  orgdata.StringToBase64.Base64ToBlob
  orgdata.StringToBase64.Base64ToBlob
Here is an example of calculating a complex token for Svea-pay:
Here is an example of how to calculate a complex token for Svea-pay:
  -- as defined in https://checkoutapistage.svea.com/docs/#/getting-started
  -- as defined in https://checkoutapistage.svea.com/docs/#/getting-started
  let orgdata=requestbody+SveaSettingsSingleton.oclSingleton.MerchantSecret+timestamp in
  let orgdata=requestbody+SveaSettingsSingleton.oclSingleton.MerchantSecret+timestamp in
Line 10: Line 10:
  <nowiki> </nowiki> )
  <nowiki> </nowiki> )
  )
  )
[[Category:OCL]]
[[Category:OCL]]
{{Edited|July|12|2024}}

Latest revision as of 15:29, 10 February 2024

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
  )
)
This page was edited 97 days ago on 02/10/2024. What links here