StringFingerprint()

Syntax

Result$ = StringFingerprint(String$, Plugin [, Bits [, Format[, HmacKey$ [, HmacKeyFormat]]]])
Description
Returns a fingerprint for the given string.

Parameters

String$ The string to hash.
Plugin The plugin to use. It can be one of the following value:
  #PB_Cipher_CRC32: uses CRC32 algorithm. UseCRC32Fingerprint() needs to be called before to register this plugin.
  #PB_Cipher_MD5  : uses MD5 algorithm. UseMD5Fingerprint() needs to be called before to register this plugin.
  #PB_Cipher_SHA1 : uses SHA1 algorithm. UseSHA1Fingerprint() needs to be called before to register this plugin.
  #PB_Cipher_SHA2 : uses SHA2 algorithm. UseSHA2Fingerprint() needs to be called before to register this plugin.
  #PB_Cipher_SHA3 : uses SHA3 algorithm. UseSHA3Fingerprint() needs to be called before to register this plugin.
The plugin to use can be combined with the #PB_Cipher_HMAC flag to compute a HMAC (hash based message authentication code) instead of a regular fingerprint. In this case the "HmacKey$" parameter is needed as well.
Bits (optional) The bits number to use for the fingerprint. It is only supported for the following plugin:
  #PB_Cipher_SHA2 : can be 224, 256 (default), 384 or 512.
  #PB_Cipher_SHA3 : can be 224, 256 (default), 384 or 512.
Format (optional) The string format to use before hashing it. It can be one of the following value:
  #PB_UTF8    : the string will be hashed in UTF8 format (default).
  #PB_Ascii   : the string will be hashed in ASCII format.
  #PB_Unicode : the string will be hashed in Unicode (UTF16) format.
HmacKey$ (optional) The secret key to use in the HMAC computation. This parameter is only used if the #PB_Cipher_HMAC is added to the plugin parameter.
HmacKeyFormat (optional) The string format to use for the HMAC key. This can be one of the following values:
  #PB_Ascii  : encode the key in ASCII
  #PB_UTF8   : encode the key on UTF-8 (default).
  #PB_Unicode: encode the key in Unicode

Return value

Returns the fingerprint as an hexadecimal string.

Example

  UseMD5Fingerprint()

  Debug StringFingerprint("yourpassword", #PB_Cipher_MD5)

Example: HMAC

  UseSHA2Fingerprint()

  ; Use hmacSha256 with both key and message in ascii
  ; Should be 4643978965ffcec6e6d73b36a39ae43ceb15f7ef8131b8307862ebc560e7f988
  Debug StringFingerprint("the message to hash here", #PB_Cipher_SHA2|#PB_Cipher_HMAC, 256, #PB_Ascii, "the shared secret key here", #PB_Ascii)

See Also

FileFingerprint(), StartFingerprint(), Fingerprint()

Supported OS

All

<- StartFingerprint() - Cipher Index - UseCRC32Fingerprint() ->