Calculates an SHA2 hash value of an input string. The required SHA2 hash length can be passed as a function argument.
Kernel.bdh
HashSha2( in sBuffer : string in nBufferLen : number optional, in eHashType : number optional ): string;
Encryption of the input string.
Parameter | Description |
---|---|
sBuffer | The input string to be encrypted. |
nBufferLen | The length of the input string. This parameter is optional, but if hashType is specified, then bufferLen must be 0 or the length of the input string. |
eHashType |
|
dcltrans transaction TMain const input := "Random String"; var sConverted : string; begin sConverted := HashSHA2(input, Strlen(input), HASH_TYPE_SHA_256); Print("sConverted = " + sConverted); sConverted := HashSHA2(input, Strlen(input)); Print("sConverted = " + sConverted); sConverted := HashSHA2(input); Print("sConverted = " + sConverted); sConverted := HashSHA2(input, 0, HASH_TYPE_SHA_224); Print("sConverted = " + sConverted); end TMain; Output sConverted = d3ffa2bcb37fb6c6a467512c2fa5b67e1a3106896e1592a858841bef06a40b81 sConverted = d3ffa2bcb37fb6c6a467512c2fa5b67e1a3106896e1592a858841bef06a40b81 sConverted = d3ffa2bcb37fb6c6a467512c2fa5b67e1a3106896e1592a858841bef06a40b81 sConverted = 5871b7141b5b9e3c2d9f5b3f87f078d951969d52e8109126a6cc0701