Cryptographic Functions
Overview
Cryptographic functions support digital signing, digital signature validation, encryption, and decryption. The functions covered in this section are:
CRYPT_GEN_RANDOM
This function isn't currently supported in PostgreSQL deployments of the Cinchy platform.
New function translations are actively being worked on by the development team; please check back at a later time.
You can review the full list of in-progress function translations here.
CRYPT_GEN_RANDOM
returns a cryptographic, randomly-generated hexadecimal number with a specific length of bytes.
Syntax
CRYPT_GEN_RANDOM (length)
Return Type
varbinary(8000)
Arguments
Argument | Description | Example |
---|---|---|
length | The length, in bytes, of the generated number. This value must be int , and range between 1-8000. | 60 |
Example
This example returns a randomly generated, 60-byte number.
SELECT CRYPT_GEN_RANDOM(50)
HASHBYTES
This function isn't currently supported in PostgreSQL deployments of the Cinchy platform.
New function translations are actively being worked on by the development team; please check back at a later time.
You can review the full list of in-progress function translations here.
HASHBYTES
Returns the HA2 hash of its input in SQL Server.
Syntax
HASHBYTES ( '<algorithm>', @input )
Return Type
varbinary(8000)
Arguments
Argument | Description | Example |
---|---|---|
algorithm | The hashing algorithm to be used. Accepts SHA2_256 and SHA2_512. | SHA2_256 |
Example
This example returns a randomly generated, 60-byte number.
DECLARE @HashThis NVARCHAR(32);
SET @HashThis = CONVERT(NVARCHAR(32),'dslfdkjLK85kldhnv$n000#knf');
SELECT HASHBYTES('SHA2_256', @HashThis);