Skip to content

qie.getSHA1Hash

Signature: qie.getSHA1Hash(value, base64Encode*)

Returns: String sha1Hash - the SHA1 hash

Returns the SHA1 hash calculated from the specified value.

Parameters

Type Name Description Default
String or byte[] value the value to calculate the SHA1 hash from
Boolean base64Encode* (optional) set to true to Base64 encode the hash value, otherwise the hash will be hex encoded false

Example

// Example: value as String, hex output (default)
var sha1Hash = qie.getSHA1Hash(
   "This will be turned into a SHA1 hash"
);


// Example: value as byte[], hex output (default)
var inputBytes = [
   84,104,105,115,32,119,105,108,108,32,98,101,32,116,117,114,110,101,100,32,
   105,110,116,111,32,97,32,83,72,65,49,32,104,97,115,104
]; // "This will be turned into a SHA1 hash"
var sha1HashFromBytes = qie.getSHA1Hash(inputBytes);


// Example: value as String, Base64 output
var sha1HashBase64 = qie.getSHA1Hash(
   "This will be turned into a SHA1 hash",
   true        // base64 encode
);