38
Views
4
Comments
SHA512 encryption in ODC
Question

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. 

2024-12-18 16-06-42
Junaid Syed

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

2024-10-15 05-27-39
Kritikz

It converts code into binary , where as i want hexadecimal conversion

2022-11-15 12-05-50
Zafar Sultan
2020-07-21 19-28-50
Rajat Agrawal
Champion

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


Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.