All Classes Namespaces Functions Variables Groups Pages
Crytographic Functions

## Functions

string | Qore::DSS (data data)
| Returns the DSS message digest (based on SHA-0 and DSA) of the supplied argument as a hex string.
string | Qore::DSS1 (data data)
| Returns the DSS1 message digest (based on SHA1 and DSA) of the supplied argument as a hex string.
binary | Qore::DSS1_bin (data data)
| Returns the DSS1 message digest (based on SHA-0 and DSA) of the supplied argument as a binary object.
binary | Qore::DSS_bin (data data)
| Returns the DSS message digest (based on SHA-0 and DSA) of the supplied argument as a binary object.
string | Qore::MD2 (data data)
| Returns the MD2 message digest of the supplied argument as a hex string.
binary | Qore::MD2_bin (data data)
| Returns the MD2 message digest of the supplied argument as binary object.
string | Qore::MD4 (data data)
| Returns the MD4 message digest of the supplied argument as a hex string.
binary | Qore::MD4_bin (data data)
| Returns the MD4 message digest of the supplied argument as a binary object.
string | Qore::MD5 (data data)
| Returns the MD5 message digest of the supplied argument as a hex string.
binary | Qore::MD5_bin (data data)
| Returns the MD5 message digest of the supplied argument as a binary object.
string | Qore::MDC2 (data data)
| Returns the MDC2 message digest of the supplied argument as a hex string.
binary | Qore::MDC2_bin (data data)
| Returns the MDC2 message digest of the supplied argument as a binary object.
string | Qore::RIPEMD160 (data data)
| Returns the RIPEMD message digest of the supplied argument as a hex string.
binary | Qore::RIPEMD160_binary (data data)
| Returns the RIPEMD message digest of the supplied argument as a binary object.
string | Qore::SHA (data data)
| Returns the SHA (outdated SHA-0) message digest of the supplied argument as a hex string.
string | Qore::SHA1 (data data)
| Returns the SHA1 message digest of the supplied argument as a hex string.
binary | Qore::SHA1_bin (data data)
| Returns the SHA1 message digest of the supplied argument as a binary object.
string | Qore::SHA224 (data data)
| Returns the SHA-224 message digest (a variant of SHA-2) of the supplied argument as a hex string.
binary | Qore::SHA224_bin (data data)
| Returns the SHA-224 message digest (a variant of SHA-2) of the supplied argument as a binary object.
string | Qore::SHA256 (data data)
| Returns the SHA-256 message digest (a variant of SHA-2) of the supplied argument as a hex string.
binary | Qore::SHA256_bin (data data)
| Returns the SHA-256 message digest (a variant of SHA-2) of the supplied argument as a binary object.
string | Qore::SHA384 (data data)
| Returns the SHA-384 message digest (a variant of SHA-2) of the supplied argument as a hex string.
binary | Qore::SHA384_bin (data data)
| Returns the SHA-384 message digest (a variant of SHA-2) of the supplied argument as a binary object.
string | Qore::SHA512 (data data)
| Returns the SHA-512 message digest (a variant of SHA-2) of the supplied argument as a hex string.
binary | Qore::SHA512_bin (data data)
| Returns the SHA-512 message digest (a variant of SHA-2) of the supplied argument as a binary object.
binary | Qore::SHA_bin (data data)
| Returns the SHA (outdated SHA-0) message digest of the supplied argument as a binary object.
binary | Qore::blowfish_decrypt_cbc (binary data, data key, data iv=Qore::DefaultIV)
| Decrypts data using the Cipher Block Chaining function for the blowfish algorithm and returns a binary object of the decrypted data.
string | Qore::blowfish_decrypt_cbc_to_string (binary data, data key, data iv=Qore::DefaultIV, *string encoding)
| Decrypts data using the Cipher Block Chaining function for the blowfish algorithm and returns a string of the decrypted data.
binary | Qore::blowfish_encrypt_cbc (data data, data key, data iv=Qore::DefaultIV)
| Encrypts data using the Cipher Block Chaining function for the blowfish algorithm
binary | Qore::cast5_decrypt_cbc (binary data, data key, data iv=Qore::DefaultIV)
| Decrypts data using the Cipher Block Chaining function for the CAST5 algorithm using a variable-length key and an optional 8-byte initialization vector.
string | Qore::cast5_decrypt_cbc_to_string (binary data, data key, data iv=Qore::DefaultIV, *string encoding)
| Decrypts data using the Cipher Block Chaining function for the CAST5 algorithm using a variable-length key and an optional 8-byte initialization vector.
binary | Qore::cast5_encrypt_cbc (data data, data key, data iv=Qore::DefaultIV)
| Encrypts data using the Cipher Block Chaining function for the CAST5 algorithm using a variable-length key and an optional 8-byte initialization vector.
binary | Qore::des_decrypt_cbc (binary data, data key, data iv=Qore::DefaultIV)
| Decrypts data using the Cipher Block Chaining function for the DES algorithm using an 8-byte key.
string | Qore::des_decrypt_cbc_to_string (binary data, data key, data iv=Qore::DefaultIV, *string encoding)
| Decrypts data using the Cipher Block Chaining function for the DES algorithm using an 8-byte key.
binary | Qore::des_ede3_decrypt_cbc (data data, data key, data iv=Qore::DefaultIV)
| Decrypts data using the Cipher Block Chaining function for the three-key triple DES algorithm using three 8-byte keys (set by a single 24-byte key argument) and an optional 8-byte initialization vector.
string | Qore::des_ede3_decrypt_cbc_to_string (binary data, data key, data iv=Qore::DefaultIV, *string encoding)
| Decrypts data using the Cipher Block Chaining function for the three-key triple DES algorithm using three 8-byte keys (set by a single 24-byte key argument) and an optional 8-byte initialization vector.
binary | Qore::des_ede3_encrypt_cbc (data data, data key, data iv=Qore::DefaultIV)
| Encrypts data using the Cipher Block Chaining function for the three-key triple DES algorithm using three 8-byte keys (set by a single 24-byte key argument) and an optional 8-byte initialization vector.
binary | Qore::des_ede_decrypt_cbc (binary data, data key, data iv=Qore::DefaultIV)
| Decrypts data using the Cipher Block Chaining function for the two-key triple DES algorithm using two eight-byte keys (set by a single 16-byte key argument)
string | Qore::des_ede_decrypt_cbc_to_string (binary data, data key, data iv=Qore::DefaultIV, *string encoding)
| Decrypts data using the Cipher Block Chaining function for the two-key triple DES algorithm using two eight-byte keys (set by a single 16-byte key argument)
binary | Qore::des_ede_encrypt_cbc (data data, data key, data iv=Qore::DefaultIV)
| Encrypts data using the Cipher Block Chaining function for the two-key triple DES algorithm using two eight-byte keys (set by a single 16-byte key argument)
binary | Qore::des_encrypt_cbc (data data, data key, data iv=Qore::DefaultIV)
| Encrypts data using the Cipher Block Chaining function for the DES algorithm using an 8-byte key.
binary | Qore::des_random_key ()
| Returns a binary object of a random key for the DES algorithm
binary | Qore::desx_decrypt_cbc (binary data, data key, data iv=Qore::DefaultIV)
| Decrypts data using the Cipher Block Chaining function for RSA's DESX algorithm using a 24-byte key and an optional 8-byte initialization vector.
string | Qore::desx_decrypt_cbc_to_string (binary data, data key, data iv=Qore::DefaultIV, *string encoding)
| Decrypts data using the Cipher Block Chaining function for RSA's DESX algorithm using a 24-byte key and an optional 8-byte initialization vector.
binary | Qore::desx_encrypt_cbc (data data, data key, data iv=Qore::DefaultIV)
| Encrypts data using the Cipher Block Chaining function for RSA's DESX algorithm using a 24-byte key and an optional 8-byte initialization vector.
binary | Qore::rc2_decrypt_cbc (binary data, data key, data iv=Qore::DefaultIV)
| Decrypts data using the Cipher Block Chaining function for RSA's RC2(tm) algorithm using a variable-length key and an optional 8-byte initialization vector.
string | Qore::rc2_decrypt_cbc_to_string (binary data, data key, data iv=Qore::DefaultIV, *string encoding)
| Decrypts data using the Cipher Block Chaining function for RSA's RC2(tm) algorithm using a variable-length key and an optional 8-byte initialization vector.
binary | Qore::rc2_encrypt_cbc (data data, data key, data iv=Qore::DefaultIV)
| Encrypts data using the Cipher Block Chaining function for RSA's RC2(tm) algorithm using a variable-length key and an optional 8-byte initialization vector.
binary | Qore::rc4_decrypt (binary data, data key, data iv=Qore::DefaultIV)
| Decrypts data using the Alleged RC4 cipher algorithm, which should be compatible with RSA's RC4(tm) algorithm using a variable-length key and an optional 8-byte initialization vector.
string | Qore::rc4_decrypt_to_string (binary data, data key, data iv=Qore::DefaultIV, *string encoding)
| Decrypts data using the Alleged RC4 cipher algorithm, which should be compatible with RSA's RC4(tm) algorithm using a variable-length key and an optional 8-byte initialization vector.
binary | Qore::rc4_encrypt (data data, data key, data iv=Qore::DefaultIV)
| Encrypts data using the Alleged RC4 cipher algorithm, which should be compatible with RSA's RC4(tm) algorithm using a variable-length key and an optional 8-byte initialization vector.
binary | Qore::rc5_decrypt_cbc (binary data, data key, data iv=Qore::DefaultIV)
| Decrypts data using the Cipher Block Chaining function for RSA's RC2(tm) algorithm using a variable-length key and an optional 8-byte initialization vector.
string | Qore::rc5_decrypt_cbc_to_string (binary data, data key, data iv=Qore::DefaultIV, *string encoding)
| Decrypts data using the Cipher Block Chaining function for RSA's RC2(tm) algorithm using a variable-length key and an optional 8-byte initialization vector.
binary | Qore::rc5_encrypt_cbc (data data, data key, data iv=Qore::DefaultIV)
| Encrypts data using the Cipher Block Chaining function for RSA's RC2(tm) algorithm using a variable-length key and an optional 8-byte initialization vector.

## Detailed Description

Qore's cryptography support is provided by the OpenSSL library. Each of the encryption and decryption functions in this section accept an optional initialization vector, which is data used as initial input for the first block in chained encryption algorithms. Subsequent blocks take input from the last block encrypted/decrypted. If an initialization vector is not supplied, a default value of 8 zero bytes will be used (see Qore::DefaultIV).

Some functions require fixed-length keys, and some allow the use of variable-length keys. For functions requiring fixed-length keys any excess bytes are ignored. The same applies to initialization vector arguments.

The following is an example of a function that uses `/dev/random` on UNIX to read in a random key for use with encryption functions:

# read a key from /dev/random and return the key
binary sub get_key(int $size) {
# throw an exception if an invalid key size was passed
if (!$size || $size < 0)
throw "GET-KEY-ERROR", sprintf("invalid size = %n", $size);
my File $f();
# File::open2() will throw an exception if /dev/random cannot be opened for reading
$f.open2("/dev/random");
return $f.readBinary($size);
}

## Function Documentation

binary Qore::blowfish_decrypt_cbc | ( | binary | data,
|  | data | key,
|  | data | iv = `Qore::DefaultIV`
| ) |  |

Decrypts data using the Cipher Block Chaining function for the blowfish algorithm and returns a binary object of the decrypted data.

Code Flags:
  RET_VALUE_ONLY

Parameters

  data | the data to be decrypted
  key | a variable-length key (recommended 16 bytes or more)
  iv | the initialization vector must be at least 8 bytes long if present

Returns
  a binary object of the decrypted data

Example:
  my binary $bin = blowfish_decrypt_cbc($data, $key);

Exceptions

  BLOWFISH-DECRYPT-PARAM-ERROR | invalid initialization vector (less than 8 bytes)
  DECRYPT-ERROR | processing error decrypting the data (for example invalid data)

string Qore::blowfish_decrypt_cbc_to_string | ( | binary | data,
|  | data | key,
|  | data | iv = `Qore::DefaultIV`,
|  | *string | encoding
| ) |  |

Decrypts data using the Cipher Block Chaining function for the blowfish algorithm and returns a string of the decrypted data.

Code Flags:
  RET_VALUE_ONLY

Parameters

  data | the data to be decrypted
  key | a variable-length key (recommended 16 bytes or more)
  iv | the initialization vector must be at least 8 bytes long if present
  encoding | the character encoding tag for the string return value; if not present, the default character encoding is assumed

Returns
  a string of the decrypted data

Example:
  my string $str = blowfish_decrypt_cbc_to_string($data, $key, NOTHING, "iso-8859-1");

Exceptions

  BLOWFISH-DECRYPT-PARAM-ERROR | invalid initialization vector (less than 8 bytes)
  DECRYPT-ERROR | processing error decrypting the data (for example invalid data)

Since
  Qore 0.8.4 added the encoding parameter to specify the output encoding of the string

binary Qore::blowfish_encrypt_cbc | ( | data | data,
|  | data | key,
|  | data | iv = `Qore::DefaultIV`
| ) |  |

Encrypts data using the Cipher Block Chaining function for the blowfish algorithm

Code Flags:
  RET_VALUE_ONLY

Parameters

  data | the data to be encrypted
  key | a variable-length key (recommended 16 bytes or more)
  iv | the initialization vector must be at least 8 bytes long if present

Returns
  a binary object of the encrypted data

Example:
  my binary $bin = blowfish_encrypt_cbc($data, $key);

Exceptions

  BLOWFISH-ENCRYPT-PARAM-ERROR | invalid initialization vector (less than 8 bytes)
  ENCRYPT-ERROR | processing error encrypting the data (should not normally happen)

binary Qore::cast5_decrypt_cbc | ( | binary | data,
|  | data | key,
|  | data | iv = `Qore::DefaultIV`
| ) |  |

Decrypts data using the Cipher Block Chaining function for the CAST5 algorithm using a variable-length key and an optional 8-byte initialization vector.

Code Flags:
  RET_VALUE_ONLY

Parameters

  data | the data to be decrypted
  key | a variable-width decryption key
  iv | the initialization vector must be at least 8 bytes long if present

Returns
  a binary object of the decrypted data

Example:
  my binary $bin = cast5_decrypt_cbc($data, $key);

Exceptions

  CAST5-DECRYPT-PARAM-ERROR | invalid initialization vector (less than 8 bytes)
  DECRYPT-ERROR | processing error decrypting the data (for example invalid data)

string Qore::cast5_decrypt_cbc_to_string | ( | binary | data,
|  | data | key,
|  | data | iv = `Qore::DefaultIV`,
|  | *string | encoding
| ) |  |

Decrypts data using the Cipher Block Chaining function for the CAST5 algorithm using a variable-length key and an optional 8-byte initialization vector.

Code Flags:
  RET_VALUE_ONLY

Parameters

  data | the data to be decrypted
  key | a variable-width decryption key
  iv | the initialization vector must be at least 8 bytes long if present
  encoding | the character encoding tag for the string return value; if not present, the default character encoding is assumed

Returns
  a string of the decrypted data

Example:
  my string $bin = cast5_decrypt_cbc_to_string($data, $key, NOTHING, "iso-8859-1");

Exceptions

  CAST5-DECRYPT-PARAM-ERROR | invalid initialization vector (less than 8 bytes)
  DECRYPT-ERROR | processing error decrypting the data (for example invalid data)

Since
  Qore 0.8.4 added the encoding parameter to specify the output encoding of the string

binary Qore::cast5_encrypt_cbc | ( | data | data,
|  | data | key,
|  | data | iv = `Qore::DefaultIV`
| ) |  |

Encrypts data using the Cipher Block Chaining function for the CAST5 algorithm using a variable-length key and an optional 8-byte initialization vector.

Code Flags:
  RET_VALUE_ONLY

Parameters

  data | the data to be encrypted
  key | a variable-width encryption key
  iv | the initialization vector must be at least 8 bytes long if present

Returns
  a binary object of the encrypted data

Example:
  my binary $bin = cast5_encrypt_cbc($data, $key);

Exceptions

  CAST5-ENCRYPT-PARAM-ERROR | invalid initialization vector (less than 8 bytes)
  ENCRYPT-ERROR | processing error encrypting the data (should not normally happen)

binary Qore::des_decrypt_cbc | ( | binary | data,
|  | data | key,
|  | data | iv = `Qore::DefaultIV`
| ) |  |

Decrypts data using the Cipher Block Chaining function for the DES algorithm using an 8-byte key.

Code Flags:
  RET_VALUE_ONLY

Parameters

  data | the data to be decrypted
  key | the decryption key must be at least 8 bytes long (only the first 8 bytes will be used)
  iv | the initialization vector must be at least 8 bytes long if present

Returns
  a binary object of the decrypted data

Example:
  my binary $bin = des_decrypt_cbc($data, $key);

Exceptions

  DES-DECRYPT-PARAM-ERROR | invalid initialization vector (less than 8 bytes)
  DES-KEY-ERROR | invalid key (too short)
  DECRYPT-ERROR | processing error decrypting the data (for example invalid data)

string Qore::des_decrypt_cbc_to_string | ( | binary | data,
|  | data | key,
|  | data | iv = `Qore::DefaultIV`,
|  | *string | encoding
| ) |  |

Decrypts data using the Cipher Block Chaining function for the DES algorithm using an 8-byte key.

Code Flags:
  RET_VALUE_ONLY

Parameters

  data | the data to be decrypted
  key | the decryption key must be at least 8 bytes long (only the first 8 bytes will be used)
  iv | the initialization vector must be at least 8 bytes long if present
  encoding | the character encoding tag for the string return value; if not present, the default character encoding is assumed

Returns
  a string of the decrypted data

Example:
  my string $bin = des_decrypt_cbc_to_string($data, $key, NOTHING, "iso-8859-1");

Exceptions

  DES-DECRYPT-PARAM-ERROR | invalid initialization vector (less than 8 bytes)
  DES-KEY-ERROR | invalid key (too short)
  DECRYPT-ERROR | processing error decrypting the data (for example invalid data)

Since
  Qore 0.8.4 added the encoding parameter to specify the output encoding of the string

binary Qore::des_ede3_decrypt_cbc | ( | data | data,
|  | data | key,
|  | data | iv = `Qore::DefaultIV`
| ) |  |

Decrypts data using the Cipher Block Chaining function for the three-key triple DES algorithm using three 8-byte keys (set by a single 24-byte key argument) and an optional 8-byte initialization vector.

Code Flags:
  RET_VALUE_ONLY

Parameters

  data | the data to be decrypted
  key | the decryption key must be at least 24 bytes long (only the first 24 bytes will be used for the three 8-byte keys)
  iv | the initialization vector must be at least 8 bytes long if present

Returns
  a binary object of the decrypted data

Example:
  my binary $bin = des_ede3_decrypt_cbc($data, $key);

Exceptions

  DES-DECRYPT-PARAM-ERROR | invalid initialization vector (less than 8 bytes)
  DES-KEY-ERROR | invalid key (too short)
  DECRYPT-ERROR | processing error decrypting the data (for example invalid data)

string Qore::des_ede3_decrypt_cbc_to_string | ( | binary | data,
|  | data | key,
|  | data | iv = `Qore::DefaultIV`,
|  | *string | encoding
| ) |  |

Decrypts data using the Cipher Block Chaining function for the three-key triple DES algorithm using three 8-byte keys (set by a single 24-byte key argument) and an optional 8-byte initialization vector.

Code Flags:
  RET_VALUE_ONLY

Parameters

  data | the data to be decrypted
  key | the decryption key must be at least 24 bytes long (only the first 24 bytes will be used for the three 8-byte keys)
  iv | the initialization vector must be at least 8 bytes long if present
  encoding | the character encoding tag for the string return value; if not present, the default character encoding is assumed

Returns
  a string of the decrypted data

Example:
  my string $bin = des_ede3_decrypt_cbc_to_string($data, $key, NOTHING, "iso-8859-1");

Exceptions

  DES-DECRYPT-PARAM-ERROR | invalid initialization vector (less than 8 bytes)
  DES-KEY-ERROR | invalid key (too short)
  DECRYPT-ERROR | processing error decrypting the data (for example invalid data)

Since
  Qore 0.8.4 added the encoding parameter to specify the output encoding of the string

binary Qore::des_ede3_encrypt_cbc | ( | data | data,
|  | data | key,
|  | data | iv = `Qore::DefaultIV`
| ) |  |

Encrypts data using the Cipher Block Chaining function for the three-key triple DES algorithm using three 8-byte keys (set by a single 24-byte key argument) and an optional 8-byte initialization vector.

Code Flags:
  RET_VALUE_ONLY

Parameters

  data | the data to be encrypted
  key | the encryption key must be at least 24 bytes long (only the first 24 bytes will be used for the three 8-byte keys)
  iv | the initialization vector must be at least 8 bytes long if present

Returns
  a binary object of the encrypted data

Example:
  my binary $bin = des_ede3_encrypt_cbc($data, $key);

Exceptions

  DES-ENCRYPT-PARAM-ERROR | invalid initialization vector (less than 8 bytes)
  DES-KEY-ERROR | invalid key (too short)
  ENCRYPT-ERROR | processing error encrypting the data (should not normally happen)

binary Qore::des_ede_decrypt_cbc | ( | binary | data,
|  | data | key,
|  | data | iv = `Qore::DefaultIV`
| ) |  |

Decrypts data using the Cipher Block Chaining function for the two-key triple DES algorithm using two eight-byte keys (set by a single 16-byte key argument)

Code Flags:
  RET_VALUE_ONLY

Parameters

  data | the data to be decrypted
  key | the decryption key must be at least 16 bytes long (only the first 16 bytes will be used for the two 8-byte keys)
  iv | the initialization vector must be at least 8 bytes long if present

Returns
  a binary object of the decrypted data

Example:
  my binary $bin = des_ede_decrypt_cbc($data, $key);

Exceptions

  DES-ENCRYPT-PARAM-ERROR | invalid initialization vector (less than 8 bytes)
  DES-KEY-ERROR | invalid key (too short)
  DECRYPT-ERROR | processing error decrypting the data (for example invalid data)

string Qore::des_ede_decrypt_cbc_to_string | ( | binary | data,
|  | data | key,
|  | data | iv = `Qore::DefaultIV`,
|  | *string | encoding
| ) |  |

Decrypts data using the Cipher Block Chaining function for the two-key triple DES algorithm using two eight-byte keys (set by a single 16-byte key argument)

Code Flags:
  RET_VALUE_ONLY

Parameters

  data | the data to be decrypted
  key | the decryption key must be at least 16 bytes long (only the first 16 bytes will be used for the two 8-byte keys)
  iv | the initialization vector must be at least 8 bytes long if present
  encoding | the character encoding tag for the string return value; if not present, the default character encoding is assumed

Returns
  a string of the decrypted data

Example:
  my string $bin = des_ede_decrypt_cbc_to_string($data, $key, NOTHING, "iso-8859-1");

Exceptions

  DES-ENCRYPT-PARAM-ERROR | invalid initialization vector (less than 8 bytes)
  DES-KEY-ERROR | invalid key (too short)
  DECRYPT-ERROR | processing error decrypting the data (for example invalid data)

Since
  Qore 0.8.4 added the encoding parameter to specify the output encoding of the string

binary Qore::des_ede_encrypt_cbc | ( | data | data,
|  | data | key,
|  | data | iv = `Qore::DefaultIV`
| ) |  |

Encrypts data using the Cipher Block Chaining function for the two-key triple DES algorithm using two eight-byte keys (set by a single 16-byte key argument)

Code Flags:
  RET_VALUE_ONLY

Parameters

  data | the data to be encrypted
  key | the encryption key must be at least 16 bytes long (only the first 16 bytes will be used for the two 8-byte keys)
  iv | the initialization vector must be at least 8 bytes long if present

Returns
  a binary object of the encrypted data

Example:
  my binary $bin = des_ede_encrypt_cbc($data, $key);

Exceptions

  DES-ENCRYPT-PARAM-ERROR | invalid initialization vector (less than 8 bytes)
  DES-KEY-ERROR | invalid key (too short)
  ENCRYPT-ERROR | processing error encrypting the data (should not normally happen)

binary Qore::des_encrypt_cbc | ( | data | data,
|  | data | key,
|  | data | iv = `Qore::DefaultIV`
| ) |  |

Encrypts data using the Cipher Block Chaining function for the DES algorithm using an 8-byte key.

Code Flags:
  RET_VALUE_ONLY

Parameters

  data | the data to be encrypted
  key | the encryption key must be at least 8 bytes long (only the first 8 bytes will be used)
  iv | the initialization vector must be at least 8 bytes long if present

Returns
  a binary object of the encrypted data

Example:
  my binary $bin = des_encrypt_cbc($data, $key);

Exceptions

  DES-ENCRYPT-PARAM-ERROR | invalid initialization vector (less than 8 bytes)
  DES-KEY-ERROR | invalid key (too short)
  ENCRYPT-ERROR | processing error encrypting the data (should not normally happen)

binary Qore::des_random_key | ( |  | ) |

Returns a binary object of a random key for the DES algorithm

Returns
  a binary object of a random key for the DES algorithm

Code Flags:
  CONSTANT

Example:
  my binary $bin = des_random_key();

binary Qore::desx_decrypt_cbc | ( | binary | data,
|  | data | key,
|  | data | iv = `Qore::DefaultIV`
| ) |  |

Decrypts data using the Cipher Block Chaining function for RSA's DESX algorithm using a 24-byte key and an optional 8-byte initialization vector.

Code Flags:
  RET_VALUE_ONLY

Parameters

  data | the data to be decrypted
  key | the decryption key must be at least 24 bytes long (only the first 24 bytes will be used)
  iv | the initialization vector must be at least 8 bytes long if present

Returns
  a binary object of the decrypted data

Example:
  my binary $bin = desx_decrypt_cbc($data, $key);

Exceptions

  DESX-DECRYPT-PARAM-ERROR | invalid initialization vector (less than 8 bytes)
  DESX-KEY-ERROR | invalid key (too short)
  DECRYPT-ERROR | processing error decrypting the data (for example invalid data)

string Qore::desx_decrypt_cbc_to_string | ( | binary | data,
|  | data | key,
|  | data | iv = `Qore::DefaultIV`,
|  | *string | encoding
| ) |  |

Decrypts data using the Cipher Block Chaining function for RSA's DESX algorithm using a 24-byte key and an optional 8-byte initialization vector.

Code Flags:
  RET_VALUE_ONLY

Parameters

  data | the data to be decrypted
  key | the decryption key must be at least 24 bytes long (only the first 24 bytes will be used)
  iv | the initialization vector must be at least 8 bytes long if present
  encoding | the character encoding tag for the string return value; if not present, the default character encoding is assumed

Returns
  a binary object of the decrypted data

Example:
  my string $str = desx_decrypt_cbc_to_string($data, $key, NOTHING, "iso-8859-1");

Exceptions

  DESX-DECRYPT-PARAM-ERROR | invalid initialization vector (less than 8 bytes)
  DESX-KEY-ERROR | invalid key (too short)
  DECRYPT-ERROR | processing error decrypting the data (for example invalid data)

Since
  Qore 0.8.4 added the encoding parameter to specify the output encoding of the string

binary Qore::desx_encrypt_cbc | ( | data | data,
|  | data | key,
|  | data | iv = `Qore::DefaultIV`
| ) |  |

Encrypts data using the Cipher Block Chaining function for RSA's DESX algorithm using a 24-byte key and an optional 8-byte initialization vector.

Code Flags:
  RET_VALUE_ONLY

Parameters

  data | the data to be encrypted
  key | the encryption key must be at least 24 bytes long (only the first 24 bytes will be used)
  iv | the initialization vector must be at least 8 bytes long if present

Returns
  a binary object of the encrypted data

Example:
  my binary $bin = desx_encrypt_cbc($data, $key);

Exceptions

  DESX-ENCRYPT-PARAM-ERROR | invalid initialization vector (less than 8 bytes)
  DESX-KEY-ERROR | invalid key (too short)
  ENCRYPT-ERROR | processing error encrypting the data (should not normally happen)

string Qore::DSS | ( | data | data | ) |

Returns the DSS message digest (based on SHA-0 and DSA) of the supplied argument as a hex string.

Code Flags:
  RET_VALUE_ONLY

Parameters

  data | the data to process and produce a digest for; the trailing null character is not included in the digest when processing string arguments

Returns
  a hex string of the digest (ex: `"aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d"`)

Example:
  my string $str = DSS("hello"); # returns "aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d"

Exceptions

  DSS-DIGEST-ERROR | error calculating digest (should not normally happen)

See Also
  DSS_bin()

Note
  this digest algorithm is considered outdated and is included for backwards-compatibility

string Qore::DSS1 | ( | data | data | ) |

Returns the DSS1 message digest (based on SHA1 and DSA) of the supplied argument as a hex string.

Code Flags:
  RET_VALUE_ONLY

Parameters

  data | the data to process and produce a digest for; the trailing null character is not included in the digest when processing string arguments

Returns
  a hex string of the digest (ex: `"aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d"`)

Example:
  my string $str = DSS1("hello"); # returns "aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d"

Exceptions

  DSS1-DIGEST-ERROR | error calculating digest (should not normally happen)

See Also
  DSS1_bin()

Note
  this digest algorithm is considered outdated and is included for backwards-compatibility

binary Qore::DSS1_bin | ( | data | data | ) |

Returns the DSS1 message digest (based on SHA-0 and DSA) of the supplied argument as a binary object.

Code Flags:
  RET_VALUE_ONLY

Parameters

  data | the data to process and produce a digest for; the trailing null character is not included in the digest when processing string arguments

Returns
  a binary object of the digest

Example:
  my binary $bin = DSS1_bin("hello");

Exceptions

  DSS1-DIGEST-ERROR | error calculating digest (should not normally happen)

See Also
  DSS1()

Note
  this digest algorithm is considered outdated and is included for backwards-compatibility

binary Qore::DSS_bin | ( | data | data | ) |

Returns the DSS message digest (based on SHA-0 and DSA) of the supplied argument as a binary object.

Code Flags:
  RET_VALUE_ONLY

Parameters

  data | the data to process and produce a digest for; the trailing null character is not included in the digest when processing string arguments

Returns
  a binary object of the digest

Example:
  my binary $bin = DSS_bin("hello");

Exceptions

  DSS-DIGEST-ERROR | error calculating digest (should not normally happen)

See Also
  DSS()

Note
  this digest algorithm is considered outdated and is included for backwards-compatibility

string Qore::MD2 | ( | data | data | ) |

Returns the MD2 message digest of the supplied argument as a hex string.

Platform Availability:
  Qore::Option::HAVE_MD2

Parameters

  data | the data to process and produce a digest for; the trailing null character is not included in the digest when processing string arguments

Returns
  a hex string of the digest (ex: `"a9046c73e00331af68917d3804f70655"`)

Example:
  my string $str = MD2("hello"); # returns "a9046c73e00331af68917d3804f70655"

Exceptions

  MD2-DIGEST-ERROR | error calculating digest (should not normally happen)

See Also
  MD2_bin()

binary Qore::MD2_bin | ( | data | data | ) |

Returns the MD2 message digest of the supplied argument as binary object.

Platform Availability:
  Qore::Option::HAVE_MD2

Code Flags:
  RET_VALUE_ONLY

Parameters

  data | the data to process and produce a digest for; the trailing null character is not included in the digest when processing string arguments

Returns
  a binary object of the digest

Example:
  my binary $bin = MD2_bin("hello");

Exceptions

  MD2-DIGEST-ERROR | error calculating digest (should not normally happen)

See Also
  MD2()

string Qore::MD4 | ( | data | data | ) |

Returns the MD4 message digest of the supplied argument as a hex string.

Code Flags:
  RET_VALUE_ONLY

Parameters

  data | the data to process and produce a digest for; the trailing null character is not included in the digest when processing string arguments

Returns
  a hex string of the digest (ex: `"866437cb7a794bce2b727acc0362ee27"`)

Example:
  my string $str = MD4("hello"); # returns "866437cb7a794bce2b727acc0362ee27"

Exceptions

  MD4-DIGEST-ERROR | error calculating digest (should not normally happen)

See Also
  MD4_bin()

binary Qore::MD4_bin | ( | data | data | ) |

Returns the MD4 message digest of the supplied argument as a binary object.

Code Flags:
  RET_VALUE_ONLY

Parameters

  data | the data to process and produce a digest for; the trailing null character is not included in the digest when processing string arguments

Returns
  a binary object of the digest

Example:
  my binary $bin = MD4_bin("hello");

Exceptions

  MD4-DIGEST-ERROR | error calculating digest (should not normally happen)

See Also
  MD4()

string Qore::MD5 | ( | data | data | ) |

Returns the MD5 message digest of the supplied argument as a hex string.

Code Flags:
  RET_VALUE_ONLY

Parameters

  data | the data to process and produce a digest for; the trailing null character is not included in the digest when processing string arguments

Returns
  a hex string of the digest (ex: `"5d41402abc4b2a76b9719d911017c592"`)

Example:
  my string $str = MD5("hello"); # returns "5d41402abc4b2a76b9719d911017c592"

Exceptions

  MD5-DIGEST-ERROR | error calculating digest (should not normally happen)

Note
  - equivalent to <string>::toMD5()
  - the MD5 algorithm is not collision-resistant; it's recommended to use another hash algorithm (like SHA-256) if cryptographic security is important

See Also
  MD5_bin()

binary Qore::MD5_bin | ( | data | data | ) |

Returns the MD5 message digest of the supplied argument as a binary object.

Code Flags:
  RET_VALUE_ONLY

Parameters

  data | the data to process and produce a digest for; the trailing null character is not included in the digest when processing string arguments

Returns
  a binary object of the digest

Example:
  my binary $bin = MD5_bin("hello");

Exceptions

  MD5-DIGEST-ERROR | error calculating digest (should not normally happen)

See Also
  MD5()

string Qore::MDC2 | ( | data | data | ) |

Returns the MDC2 message digest of the supplied argument as a hex string.

Platform Availability:
  Qore::Option::HAVE_MDC2

Code Flags:
  RET_VALUE_ONLY

Parameters

  data | the data to process and produce a digest for; the trailing null character is not included in the digest when processing string arguments

Returns
  a hex string of the digest (ex: `"4517036cf97b2407d6fe22aa5ab878a3"`)

Example:
  my string $str = MDC2("hello"); # returns "4517036cf97b2407d6fe22aa5ab878a3"

Exceptions

  MDC2-DIGEST-ERROR | error calculating digest (should not normally happen)

See Also
  MDC2_bin()

binary Qore::MDC2_bin | ( | data | data | ) |

Returns the MDC2 message digest of the supplied argument as a binary object.

Platform Availability:
  Qore::Option::HAVE_MDC2

Code Flags:
  RET_VALUE_ONLY

Parameters

  data | the data to process and produce a digest for; the trailing null character is not included in the digest when processing string arguments

Returns
  a binary object of the digest

Example:
  my binary $bin = MDC2_bin("hello");

Exceptions

  MDC2-DIGEST-ERROR | error calculating digest (should not normally happen)

See Also
  MDC2_bin()

binary Qore::rc2_decrypt_cbc | ( | binary | data,
|  | data | key,
|  | data | iv = `Qore::DefaultIV`
| ) |  |

Decrypts data using the Cipher Block Chaining function for RSA's RC2(tm) algorithm using a variable-length key and an optional 8-byte initialization vector.

Code Flags:
  RET_VALUE_ONLY

Parameters

  data | the data to be decrypted
  key | a variable-width decryption key
  iv | the initialization vector must be at least 8 bytes long if present

Returns
  a binary object of the decrypted data

Example:
  my binary $bin = rc2_decrypt_cbc($data, $key);

Exceptions

  RC2-DECRYPT-PARAM-ERROR | invalid initialization vector (less than 8 bytes)
  DECRYPT-ERROR | processing error decrypting the data (for example invalid data)

string Qore::rc2_decrypt_cbc_to_string | ( | binary | data,
|  | data | key,
|  | data | iv = `Qore::DefaultIV`,
|  | *string | encoding
| ) |  |

Decrypts data using the Cipher Block Chaining function for RSA's RC2(tm) algorithm using a variable-length key and an optional 8-byte initialization vector.

Code Flags:
  RET_VALUE_ONLY

Parameters

  data | the data to be decrypted
  key | a variable-width decryption key
  iv | the initialization vector must be at least 8 bytes long if present
  encoding | the character encoding tag for the string return value; if not present, the default character encoding is assumed

Returns
  a string of the decrypted data

Example:
  my string $str = rc2_decrypt_cbc_to_string($data, $key);

Exceptions

  RC2-DECRYPT-PARAM-ERROR | invalid initialization vector (less than 8 bytes)
  DECRYPT-ERROR | processing error decrypting the data (for example invalid data)

Since
  Qore 0.8.4 added the encoding parameter to specify the output encoding of the string

binary Qore::rc2_encrypt_cbc | ( | data | data,
|  | data | key,
|  | data | iv = `Qore::DefaultIV`
| ) |  |

Encrypts data using the Cipher Block Chaining function for RSA's RC2(tm) algorithm using a variable-length key and an optional 8-byte initialization vector.

Code Flags:
  RET_VALUE_ONLY

Parameters

  data | the data to be encrypted
  key | a variable-width encryption key
  iv | the initialization vector must be at least 8 bytes long if present

Returns
  a binary object of the encrypted data

Example:
  my binary $bin = rc2_encrypt_cbc($data, $key);

Exceptions

  RC2-ENCRYPT-PARAM-ERROR | invalid initialization vector (less than 8 bytes)
  ENCRYPT-ERROR | processing error encrypting the data (should not normally happen)

binary Qore::rc4_decrypt | ( | binary | data,
|  | data | key,
|  | data | iv = `Qore::DefaultIV`
| ) |  |

Decrypts data using the Alleged RC4 cipher algorithm, which should be compatible with RSA's RC4(tm) algorithm using a variable-length key and an optional 8-byte initialization vector.

Code Flags:
  RET_VALUE_ONLY

Parameters

  data | the data to be decrypted
  key | a variable-width decryption key
  iv | the initialization vector must be at least 8 bytes long if present

Returns
  a binary object of the decrypted data

Example:
  my binary $bin = rc4_decrypt($data, $key);

Exceptions

  RC4-DECRYPT-PARAM-ERROR | invalid initialization vector (less than 8 bytes)
  DECRYPT-ERROR | processing error decrypting the data (for example invalid data)

string Qore::rc4_decrypt_to_string | ( | binary | data,
|  | data | key,
|  | data | iv = `Qore::DefaultIV`,
|  | *string | encoding
| ) |  |

Decrypts data using the Alleged RC4 cipher algorithm, which should be compatible with RSA's RC4(tm) algorithm using a variable-length key and an optional 8-byte initialization vector.

Code Flags:
  RET_VALUE_ONLY

Parameters

  data | the data to be decrypted
  key | a variable-width decryption key
  iv | the initialization vector must be at least 8 bytes long if present
  encoding | the character encoding tag for the string return value; if not present, the default character encoding is assumed

Returns
  a string of the decrypted data

Example:
  my string $str = rc4_decrypt_to_string($encrypted_data, $key, NOTHING, "iso-8859-1");

Exceptions

  RC4-DECRYPT-PARAM-ERROR | invalid initialization vector (less than 8 bytes)
  DECRYPT-ERROR | processing error decrypting the data (for example invalid data)

Since
  Qore 0.8.4 added the encoding parameter to specify the output encoding of the string

binary Qore::rc4_encrypt | ( | data | data,
|  | data | key,
|  | data | iv = `Qore::DefaultIV`
| ) |  |

Encrypts data using the Alleged RC4 cipher algorithm, which should be compatible with RSA's RC4(tm) algorithm using a variable-length key and an optional 8-byte initialization vector.

Code Flags:
  RET_VALUE_ONLY

Parameters

  data | the data to be encrypted
  key | a variable-width encryption key
  iv | the initialization vector must be at least 8 bytes long if present

Returns
  a binary object of the encrypted data

Example:
  my binary $bin = rc4_encrypt($data, $key);

Exceptions

  RC4-ENCRYPT-PARAM-ERROR | invalid initialization vector (less than 8 bytes)
  ENCRYPT-ERROR | processing error encrypting the data (should not normally happen)

binary Qore::rc5_decrypt_cbc | ( | binary | data,
|  | data | key,
|  | data | iv = `Qore::DefaultIV`
| ) |  |

Decrypts data using the Cipher Block Chaining function for RSA's RC2(tm) algorithm using a variable-length key and an optional 8-byte initialization vector.

Platform Availability:
  Qore::Option::HAVE_RC5

Code Flags:
  RET_VALUE_ONLY

Parameters

  data | the data to be decrypted
  key | a variable-width decryption key
  iv | the initialization vector must be at least 8 bytes long if present

Returns
  a binary object of the decrypted data

Example:
  my binary $bin = rc2_decrypt_cbc($data, $key);

Exceptions

  RC5-DECRYPT-PARAM-ERROR | invalid initialization vector (less than 8 bytes)
  DECRYPT-ERROR | processing error decrypting the data (for example invalid data)

string Qore::rc5_decrypt_cbc_to_string | ( | binary | data,
|  | data | key,
|  | data | iv = `Qore::DefaultIV`,
|  | *string | encoding
| ) |  |

Decrypts data using the Cipher Block Chaining function for RSA's RC2(tm) algorithm using a variable-length key and an optional 8-byte initialization vector.

Platform Availability:
  Qore::Option::HAVE_RC5

Code Flags:
  RET_VALUE_ONLY

Parameters

  data | the data to be decrypted
  key | a variable-width decryption key
  iv | the initialization vector must be at least 8 bytes long if present
  encoding | the character encoding tag for the string return value; if not present, the default character encoding is assumed

Returns
  a string of the decrypted data

Example:
  my string $str = rc2_decrypt_cbc_to_string($data, $key, NOTHING, "iso-8859-1");

Exceptions

  RC5-DECRYPT-PARAM-ERROR | invalid initialization vector (less than 8 bytes)
  DECRYPT-ERROR | processing error decrypting the data (for example invalid data)

Since
  Qore 0.8.4 added the encoding parameter to specify the output encoding of the string

binary Qore::rc5_encrypt_cbc | ( | data | data,
|  | data | key,
|  | data | iv = `Qore::DefaultIV`
| ) |  |

Encrypts data using the Cipher Block Chaining function for RSA's RC2(tm) algorithm using a variable-length key and an optional 8-byte initialization vector.

Platform Availability:
  Qore::Option::HAVE_RC5

Code Flags:
  RET_VALUE_ONLY

Parameters

  data | the data to be encrypted
  key | a variable-width encryption key
  iv | the initialization vector must be at least 8 bytes long if present

Returns
  a binary object of the encrypted data

Example:
  my binary $bin = rc2_encrypt_cbc($data, $key);

Exceptions

  RC5-ENCRYPT-PARAM-ERROR | invalid initialization vector (less than 8 bytes)
  ENCRYPT-ERROR | processing error encrypting the data (should not normally happen)

string Qore::RIPEMD160 | ( | data | data | ) |

Returns the RIPEMD message digest of the supplied argument as a hex string.

Code Flags:
  RET_VALUE_ONLY

Parameters

  data | the data to process and produce a digest for; the trailing null character is not included in the digest when processing string arguments

Returns
  a hex string of the digest (ex: `"108f07b8382412612c048d07d13f814118445acd"`)

Example:
  my string $str = RIPEMD160("hello"); # returns "108f07b8382412612c048d07d13f814118445acd"

Exceptions

  RIPEMD160-DIGEST-ERROR | error calculating digest (should not normally happen)

See Also
  RIPEMD160_bin()

binary Qore::RIPEMD160_binary | ( | data | data | ) |

Returns the RIPEMD message digest of the supplied argument as a binary object.

Code Flags:
  RET_VALUE_ONLY

Parameters

  data | the data to process and produce a digest for; the trailing null character is not included in the digest when processing string arguments

Returns
  a binary object of the digest

Example:
  my binary $bin = RIPEMD160_bin("hello");

Exceptions

  RIPEMD160-DIGEST-ERROR | error calculating digest (should not normally happen)

See Also
  RIPEMD160()

string Qore::SHA | ( | data | data | ) |

Returns the SHA (outdated SHA-0) message digest of the supplied argument as a hex string.

This hash algorithm was withdrawn after publishing and is considered to have serious flaws.

Code Flags:
  RET_VALUE_ONLY

Parameters

  data | the data to process and produce a digest for; the trailing null character is not included in the digest when processing string arguments

Returns
  a hex string of the digest (ex: `"ac62a630ca850b4ea07eda664eaecf9480843152"`)

Example:
  my string $str = SHA("hello"); returns "ac62a630ca850b4ea07eda664eaecf9480843152"

Exceptions

  SHA-DIGEST-ERROR | error calculating digest (should not normally happen)

See Also
  SHA_bin()

string Qore::SHA1 | ( | data | data | ) |

Returns the SHA1 message digest of the supplied argument as a hex string.

Code Flags:
  RET_VALUE_ONLY

Parameters

  data | the data to process and produce a digest for; the trailing null character is not included in the digest when processing string arguments

Returns
  a hex string of the digest (ex: `"aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d"`)

Example:
  my string $str = SHA1("hello"); # "aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d"

Exceptions

  SHA1-DIGEST-ERROR | error calculating digest (should not normally happen)

Note
  equivalent to <string>::toSHA1()

See Also
  SHA1_bin()

binary Qore::SHA1_bin | ( | data | data | ) |

Returns the SHA1 message digest of the supplied argument as a binary object.

Code Flags:
  RET_VALUE_ONLY

Parameters

  data | the data to process and produce a digest for; the trailing null character is not included in the digest when processing string arguments

Returns
  a binary object of the digest

Example:
  my binary $bin = SHA1_bin("hello");

Exceptions

  SHA1-DIGEST-ERROR | error calculating digest (should not normally happen)

See Also
  SHA1()

string Qore::SHA224 | ( | data | data | ) |

Returns the SHA-224 message digest (a variant of SHA-2) of the supplied argument as a hex string.

Platform Availability:
  Qore::Option::HAVE_SHA224

Code Flags:
  RET_VALUE_ONLY

Parameters

  data | the data to process and produce a digest for; the trailing null character is not included in the digest when processing string arguments

Returns
  a hex string of the digest (ex: `"ea09ae9cc6768c50fcee903ed054556e5bfc8347907f12598aa24193"`)

Example:
  my string $str = SHA224("hello"); # returns "ea09ae9cc6768c50fcee903ed054556e5bfc8347907f12598aa24193"

Exceptions

  SHA224-DIGEST-ERROR | error calculating digest (should not normally happen)

Note
  equivalent to <string>::toSHA224()

See Also
  SHA224_bin()

binary Qore::SHA224_bin | ( | data | data | ) |

Returns the SHA-224 message digest (a variant of SHA-2) of the supplied argument as a binary object.

Platform Availability:
  Qore::Option::HAVE_SHA224

Code Flags:
  RET_VALUE_ONLY

Parameters

  data | the data to process and produce a digest for; the trailing null character is not included in the digest when processing string arguments

Returns
  a binary object of the digest

Example:
  my binary $bin = SHA224_bin("hello");

Exceptions

  SHA224-DIGEST-ERROR | error calculating digest (should not normally happen)

See Also
  SHA224()

string Qore::SHA256 | ( | data | data | ) |

Returns the SHA-256 message digest (a variant of SHA-2) of the supplied argument as a hex string.

Platform Availability:
  Qore::Option::HAVE_SHA256

Code Flags:
  RET_VALUE_ONLY

Parameters

  data | the data to process and produce a digest for; the trailing null character is not included in the digest when processing string arguments

Returns
  a hex string of the digest (ex: `"2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824"`)

Example:
  my string $str = SHA256("hello"); # returns "2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824"

Exceptions

  SHA256-DIGEST-ERROR | error calculating digest (should not normally happen)

Note
  equivalent to <string>::toSHA256()

See Also
  SHA256_bin()

binary Qore::SHA256_bin | ( | data | data | ) |

Returns the SHA-256 message digest (a variant of SHA-2) of the supplied argument as a binary object.

Platform Availability:
  Qore::Option::HAVE_SHA256

Code Flags:
  RET_VALUE_ONLY

Parameters

  data | the data to process and produce a digest for; the trailing null character is not included in the digest when processing string arguments

Returns
  a binary object of the digest

Example:
  my binary $bin = SHA256_bin("hello");

Exceptions

  SHA256-DIGEST-ERROR | error calculating digest (should not normally happen)

See Also
  SHA256()

string Qore::SHA384 | ( | data | data | ) |

Returns the SHA-384 message digest (a variant of SHA-2) of the supplied argument as a hex string.

Platform Availability:
  Qore::Option::HAVE_SHA384

Code Flags:
  RET_VALUE_ONLY

Parameters

  data | the data to process and produce a digest for; the trailing null character is not included in the digest when processing string arguments

Returns
  a hex string of the digest (ex: `"59e1748777448c69de6b800d7a33bbfb9ff1b463e44354c3553bcdb9c666fa90125a3c79f90397bdf5f6a13de828684f"`)

Example:
  my string $str = SHA384("hello"); # returns "59e1748777448c69de6b800d7a33bbfb9ff1b463e44354c3553bcdb9c666fa90125a3c79f90397bdf5f6a13de828684f"

Exceptions

  SHA384-DIGEST-ERROR | error calculating digest (should not normally happen)

Note
  equivalent to <string>::toSHA384()

See Also
  SHA384_bin()

binary Qore::SHA384_bin | ( | data | data | ) |

Returns the SHA-384 message digest (a variant of SHA-2) of the supplied argument as a binary object.

Platform Availability:
  Qore::Option::HAVE_SHA384

Code Flags:
  RET_VALUE_ONLY

Parameters

  data | the data to process and produce a digest for; the trailing null character is not included in the digest when processing string arguments

Returns
  a binary object of the digest

Example:
  my binary $bin = SHA384_bin("hello");

Exceptions

  SHA384-DIGEST-ERROR | error calculating digest (should not normally happen)

See Also
  SHA384()

string Qore::SHA512 | ( | data | data | ) |

Returns the SHA-512 message digest (a variant of SHA-2) of the supplied argument as a hex string.

Platform Availability:
  Qore::Option::HAVE_SHA512

Code Flags:
  RET_VALUE_ONLY

Parameters

  data | the data to process and produce a digest for; the trailing null character is not included in the digest when processing string arguments

Returns
  a hex string of the digest (ex: `"9b71d224bd62f3785d96d46ad3ea3d73319bfbc2890caadae2dff72519673ca72323c3d99ba5c11d7c7acc6e14b8c5da0c4663475c2e5c3adef46f73bcdec043"`)

Example:
  my string $str = SHA512("hello"); # returns "9b71d224bd62f3785d96d46ad3ea3d73319bfbc2890caadae2dff72519673ca72323c3d99ba5c11d7c7acc6e14b8c5da0c4663475c2e5c3adef46f73bcdec043"

Exceptions

  SHA512-DIGEST-ERROR | error calculating digest (should not normally happen)

Note
  equivalent to <string>::toSHA512()

See Also
  SHA512_bin()

binary Qore::SHA512_bin | ( | data | data | ) |

Returns the SHA-512 message digest (a variant of SHA-2) of the supplied argument as a binary object.

Platform Availability:
  Qore::Option::HAVE_SHA512

Code Flags:
  RET_VALUE_ONLY

Parameters

  data | the data to process and produce a digest for; the trailing null character is not included in the digest when processing string arguments

Returns
  a binary object of the digest

Example:
  my binary $bin = SHA512_bin("hello");

Exceptions

  SHA512-DIGEST-ERROR | error calculating digest (should not normally happen)

See Also
  SHA512()

binary Qore::SHA_bin | ( | data | data | ) |

Returns the SHA (outdated SHA-0) message digest of the supplied argument as a binary object.

This hash algorithm was withdrawn after publishing and is considered to have serious flaws.

Code Flags:
  RET_VALUE_ONLY

Parameters

  data | the data to process and produce a digest for; the trailing null character is not included in the digest when processing string arguments

Returns
  a binary object of the digest

Example:
  my binary $bin = SHA_bin("hello");

Exceptions

  SHA-DIGEST-ERROR | error calculating digest (should not normally happen)

See Also
  SHA()