We have a requirement in which we have to consume an API which requires us to create a SHA512 encrypted signature and pass it to the API header but we are not able to encode the signature in SHA512 ,couldn't find any action to achieve this, when we did some research about it we came to know it was available in O11. Please help us to locate this action in ODC.
Hello Kriticz,
The ODC Security library provides various actions to perform different security related operations. One of them is ComputeTextHash which as per the documentation follows SHA512 algorithm. I think it might help you to achieve what you need.
https://success.outsystems.com/documentation/outsystems_developer_cloud/outsystems_language_and_elements/libraries/security/
Hope it helps!
Junaid
It converts code into binary , where as i want hexadecimal conversion
If you have the binary data, you can convert it to hexadecimal equivalent using BinaryDataToHex method from here: https://success.outsystems.com/documentation/outsystems_developer_cloud/outsystems_language_and_elements/libraries/binarydata/
Hi @Kritikz
Try below java script which are able to convert Text into SHA512 encrypted format.
async function generateSHA512(input) {
const encoder = new TextEncoder();
const data = encoder.encode(input);
const hashBuffer = await crypto.subtle.digest('SHA-512', data);
const hashArray = Array.from(new Uint8Array(hashBuffer));
const hashHex = hashArray.map(byte => byte.toString(16).padStart(2, '0')).join('');
return hashHex;
}
generateSHA512("TestString").then(hashValue => {
console.log("Generated Hash:", hashValue);
alert("Generated SHA-512 Hash: " + hashValue);
});
Regards ,
Rajat