Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
ceosis79
Contributor II
Contributor II

Using the SHA256() function

We construct with four fields a concatenated code without special characters (no accents, no hyphens) or capital letters, assembled with pipe characters: |

This code is then hashed with a SHA256 function.

Example

Will have initial code: demezancon|jeanfrancois|21121987|99129

Once hashed: 2a5bc014151a1b36c93ae134100f6f474283712d91d58f51ddc169fa3224a7b3

 

But when I use the following function: Hash256('demezancon|jeanfrancois|21121987|99129')

I get a totally different result: LS;:]<+<%&GT::)U9:#&Q<58`EWE<>RU!KGN:8ZS,EU

I can't figure out what's missing in my formula to get the expected result.

Thank you in advance for your help.

Labels (4)
2 Solutions

Accepted Solutions
Anil_Babu_Samineni

@ceosis79 As per this, Hash256 - script and chart function | Qlik Sense on Windows Help It seems the result is OK?

But, The title says SHA256()?

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful

View solution in original post

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Qlik Hash256() does not use the same hashing algorithm as SHA256(). SHA256() would use SHA, while Hash256() apparently uses something different. 
https://support.qlik.com/articles/000026464

You'll find other questions in this forum about how to possibly replicate SHA256 in Qlik Sense. I don't think it's possible without using an external routine like an SSE.

-Rob

View solution in original post

6 Replies
Anil_Babu_Samineni

@ceosis79 As per this, Hash256 - script and chart function | Qlik Sense on Windows Help It seems the result is OK?

But, The title says SHA256()?

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
jmmayoral3
Creator
Creator

Hello Ceosis.
I would need to know how you are concatenating the fields and how you are using that concatenation in hash256() so that it returns 2a5bc014151a1b36c93ae134100f6f474283712d91d58f51ddc169fa3224a7b3
Because I have used this script :

 

My_TABLE:

load *, a&'|'&b&'|'&c&'|'&d as h;
LOAD * INLINE[
a,b,c,d
demezancon,jeanfrancois,21121987,99129
];

and the results that always give me the same:

hash256(a&'|'&b&'|'&c&'|'&d) --> LS;:]<+<%&GT::)U9:#&Q<58`EWE<>RU!KGN:8ZS,EU

hash256(h)                            --> LS;:]<+<%&GT::)U9:#&Q<58`EWE<>RU!KGN:8ZS,EU

hash256('demezancon|jeanfrancois|21121987|99129') --> LS;:]<+<%&GT::)U9:#&Q<58`EWE<>RU!KGN:8ZS,EU

 

Except when I use this sentence:

hash256(a,b,c,d) --> HP"^B!*T9M.%"*(6D4F.16PV>_%#:GL<U[C]LZR\\H#

 

ceosis79
Contributor II
Contributor II
Author

Hello @jmmayoral3  and @Anil_Babu_Samineni 

The example is provided by my central administration, when I saw a different output I checked the calculation with various online tools and get the same result than the example :

https://passwordsgenerator.net/sha256-hash-generator/
https://emn178.github.io/online-tools/sha256.html
https://tools.keycdn.com/sha256-online-generator

Maybe the Qlik Sense function hash256() needs a specific argument to define the proper algorithm or I need to use an other  function.

 

Could you guys help tel me how to achieve this in Qlik Sense ?

 

Anil_Babu_Samineni

@ceosis79 Can we know what you want to use after you use below one?

Hash256('demezancon|jeanfrancois|21121987|99129').

I can see @jmmayoral3 explained the same how Qlik works. 

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Qlik Hash256() does not use the same hashing algorithm as SHA256(). SHA256() would use SHA, while Hash256() apparently uses something different. 
https://support.qlik.com/articles/000026464

You'll find other questions in this forum about how to possibly replicate SHA256 in Qlik Sense. I don't think it's possible without using an external routine like an SSE.

-Rob

ceosis79
Contributor II
Contributor II
Author

Thanks Rob, for your explanation.

It's clear now that Qlik Sense function Hash256() is not a solution for me to provide this encrypted field in the format I have to deliver.

I should have notice like @Anil_Babu_Samineni  the subtle difference between SHA256 and HASH256 !

Sorry to have bother you three with this beginner's question… 

 

Best regards
Vladimir