HashInfo Plugin



1. INTRODUCTION

HashInfo plugin for NSIS provides several cryptographic functions that allow you to generate hash values for a given string or file. Installer creator (NSIS based) can use one of the many hash algorithms.

Current version of plugin allows you to get data for several categories. Below, you can find all functions supported by plugin with description and example usage. More information about HashInfo plugin can be found in the file "HashInfoDemo.nsi", which is attached to the archive file of the HashInfo plugin.


The plugin is based on the HashLib4Pascal library, which provides an easy-to-use interface for calculating hashes and checksums.



2. GENERAL USAGE

Function .onInit

  HashInfo::FunctionName "PARAM1" "PARAM2"
      ; Function can take parameters
      ; Parameters usage depends on given function (always required)

  Pop $0 
         ; The function returns the retrieved value in the variable $0
         ; The function returns "error" if there is an error

FunctionEnd

2.1. CHECKSUM

A checksum is a small-sized block of data derived from another block of digital data for the purpose of detecting errors that may have been introduced during its transmission or storage. By themselves, checksums are often used to verify data integrity but are not relied upon to verify data authenticity.

Available Hash Algorithms: Adler-32

  1a. Compute the checksum value for a given STRING

  ; Usage
  ; HashInfo::FunctionName "PARAM1" "PARAM2"
       ; PARAM1 -> Hash Algorithm (Obligatory)
       ; PARAM2 -> String (Obligatory)
       ; Notes:
       ; - Function returns "error" if something goes wrong

  StrCpy $R0 "Adler-32"     ; PARAM1
  StrCpy $R1 "Hello World" ; PARAM2
  HashInfo::GetStrCRCHash "$R0" "$R1"
  Pop $0 
  DetailPrint "   Hash Alghoritm: $R0"
  DetailPrint "   Input String: $R1"
  DetailPrint "   Output Hash: $0"
  1b. Compute the checksum value for a given FILE

  ; Usage
  ; HashInfo::FunctionName "PARAM1" "PARAM2"
       ; PARAM1 -> Hash Algorithm (Obligatory)
       ; PARAM2 -> Full Path to File (Obligatory)
       ; Notes:
       ; - Function returns "error" if something goes wrong

  StrCpy $R0 "Adler-32"    ; PARAM1
  StrCpy $R1 "$EXEPATH" ; PARAM2
  HashInfo::GetFileCRCHash "$R0" "$R1"
  Pop $0
  DetailPrint "   Hash Alghoritm: $R0"
  DetailPrint "   Input File: $R1"
  DetailPrint "   Output Hash: $0"

2.2. CRC (CYCLIC REDUNDANCY CHECK)

A cyclic redundancy check (CRC)is an error-detecting code commonly used in digital networks and storage devices to detect accidental changes to digital data. Blocks of data entering these systems get a short check value attached, based on the remainder of a polynomial division of their contents. On retrieval, the calculation is repeated and, in the event the check values do not match, corrective action can be taken against data corruption. CRCs can be used for error correction. CRCs are so called because the check (data verification) value is a redundancy (it expands the message without adding information) and the algorithm is based on cyclic codes.

Available Hash Algorithms:
CRC-3/GSM, CRC-3/ROHC, CRC-4/INTERLAKEN, CRC-4/ITU, CRC-4/G-704, CRC-5/EPC, CRC-5/EPC-C1G2, CRC-5/ITU, CRC-5/G-704, CRC-5/USB, CRC-6/CDMA2000-A, CRC-6/CDMA2000-B, CRC-6/DARC, CRC-6/GSM, CRC-6/ITU, CRC-6/G-704, CRC-7, CRC-7/MMC, CRC-7/ROHC, CRC-7/UMTS, CRC-8, CRC-8/SMBUS, CRC-8/AUTOSAR, CRC-8/BLUETOOTH, CRC-8/CDMA2000, CRC-8/DARC, CRC-8/DVB-S2, CRC-8/EBU, CRC-8/AES, CRC-8/TECH-3250, CRC-8/GSM-A, CRC-8/GSM-B, CRC-8/I-CODE, CRC-8/ITU, CRC-8/I-432-1, CRC-8/LTE, CRC-8/MAXIM, DOW-CRC, CRC-8/MAXIM-DOW, CRC-8/OPENSAFETY, CRC-8/ROHC, CRC-8/SAE-J1850, CRC-8/WCDMA, CRC-8/MIFARE-MAD, CRC-8/NRSC-5, CRC-10, CRC-10/ATM, CRC-10/I-610, CRC-10/CDMA2000, CRC-10/GSM, CRC-11, CRC-11/FLEXRAY, CRC-11/UMTS, CRC-12/CDMA2000, CRC-12/DECT, X-CRC-12, CRC-12/GSM, CRC-12/UMTS, CRC-12/3GPP, CRC-13/BBC, CRC-14/DARC, CRC-14/GSM, CRC-15, CRC-15/CAN, CRC-15/MPT1327, CRC-16, ARC, CRC-IBM, CRC-16/ARC, CRC-16/LHA, CRC-16/AUG-CCITT, CRC-16/SPI-FUJITSU, CRC-16/BUYPASS, CRC-16/VERIFONE, CRC-16/UMTS, CRC-16/CCITT-FALSE, CRC-16/AUTOSAR, CRC-16/IBM-3740, CRC-16/CDMA2000, CRC-16/CMS, CRC-16/DDS-110, CRC-16/DECT-R, R-CRC-16, CRC-16/DECT-X, X-CRC-16, CRC-16/DNP, CRC-16/EN13757, CRC-16/GENIBUS, CRC-16/EPC, CRC-16/I-CODE, CRC-16/DARC, CRC-16/EPC-C1G2, CRC-16/GSM, CRC-16/LJ1200, CRC-16/MAXIM, CRC-16/MAXIM-DOW, CRC-16/MCRF4XX, CRC-16/OPENSAFETY-A, CRC-16/OPENSAFETY-B, CRC-16/PROFIBUS, CRC-16/IEC-61158-2, CRC-16/RIELLO, CRC-16/T10-DIF, CRC-16/TELEDISK, CRC-16/TMS37157, CRC-16/USB, CRC-A, CRC-16/ISO-IEC-14443-3-A, KERMIT, CRC-16/CCITT, CRC-16/CCITT-TRUE, CRC-CCITT, CRC-16/KERMIT, CRC-16/V-41-LSB, MODBUS, CRC-16/MODBUS, X-25, CRC-16/IBM-SDLC, CRC-16/ISO-HDLC, CRC-16/ISO-IEC-14443-3-B, CRC-B, CRC-16/X-25, XMODEM, ZMODEM, CRC-16/ACORN, CRC-16/XMODEM, CRC-16/V-41-MSB, CRC-16/NRSC-5, CRC-17/CAN-FD, CRC-21/CAN-FD, CRC-24, CRC-24/OPENPGP, CRC-24/BLE, CRC-24/FLEXRAY-A, CRC-24/FLEXRAY-B, CRC-24/INTERLAKEN, CRC-24/LTE-A, CRC-24/LTE-B, CRC-24/OS-9, CRC-30/CDMA, CRC-31/PHILLIPS, CRC-32, CRC-32/ADCCP, CRC-32/V-42, CRC-32/XZ, PKZIP, CRC-32/ISO-HDLC, CRC-32/AUTOSAR, CRC-32/BZIP2, CRC-32/AAL5, CRC-32/DECT-B, B-CRC-32, CRC-32C, CRC-32/BASE91-C, CRC-32/CASTAGNOLI, CRC-32/INTERLAKEN, CRC-32/ISCSI, CRC-32D, CRC-32/BASE91-D, CRC-32/MPEG-2, CRC-32/POSIX, CKSUM, CRC-32Q, CRC-32/AIXM, JAMCRC, CRC-32/JAMCRC, XFER, CRC-32/XFER, CRC-32/CD-ROM-EDC, CRC-40/GSM, CRC-64, CRC-64/ECMA-182, CRC-64/GO-ISO, CRC-64/WE, CRC-64/XZ, CRC-64/GO-ECMA, CRC-64/1B, CRC-64/Jones

  1a. Compute the CRC Hash value for a given STRING

  ; Usage
  ; HashInfo::FunctionName "PARAM1" "PARAM2"
       ; PARAM1 -> CRC Hash Algorithm (Obligatory)
       ; PARAM2 -> String (Obligatory)
       ; Notes:
       ; - Function returns "error" if something goes wrong

  StrCpy $R0 "CRC-32"      ; PARAM1
  StrCpy $R1 "Hello World" ; PARAM2
  HashInfo::GetStrCRCHash "$R0" "$R1"
  Pop $0 
  DetailPrint "   Hash Alghoritm: $R0"
  DetailPrint "   Input String: $R1"
  DetailPrint "   Output Hash: $0"
  1b. Compute the CRC Hash value for a given FILE

  ; Usage
  ; HashInfo::FunctionName "PARAM1" "PARAM2"
       ; PARAM1 -> CRC Hash Algorithm (Obligatory)
       ; PARAM2 -> Full Path to File (Obligatory)
       ; Notes:
       ; - Function returns "error" if something goes wrong

  StrCpy $R0 "CRC-32"     ; PARAM1
  StrCpy $R1 "$EXEPATH" ; PARAM2
  HashInfo::GetFileCRCHash "$R0" "$R1"
  Pop $0
  DetailPrint "   Hash Alghoritm: $R0"
  DetailPrint "   Input File: $R1"
  DetailPrint "   Output Hash: $0"

2.3. NON-CRYPTOGRAPHIC HASH FUNCTIONS

Non-cryptographic hash functions provide weaker guarantees in exchange for performance improvements (don't provide certain security guarantees). They just try to avoid collisions for non malicious input. An example would be to detect data corruption due to an unstable network.

Available Hash Algorithms:
AP, Bernstein, Bernstein1, BKDR, DEK, DJB, ELF, FNV, FNV1a, Jenkins3, JS, Murmur2, MurmurHash3_x86_32, OneAtTime, PJW, Rotating, RS, SDBM, ShiftAndXor, SuperFast, XXHash32, FNV_64, FNV1a_64, Murmur2_64, SipHash2_4, XXHash64, SipHash128_2_4, MurmurHash3_x86_128, MurmurHash3_x64_128

  1a. Compute the Non-Cryptographic Hash value for a given STRING

  ; Usage
  ; HashInfo::FunctionName "PARAM1" "PARAM2"
       ; PARAM1 -> Hash Algorithm (Obligatory)
       ; PARAM2 -> String (Obligatory)
       ; Notes:
       ; - Function returns "error" if something goes wrong

  StrCpy $R0 "Bernstein"    ; PARAM1
  StrCpy $R1 "Hello World" ; PARAM2
  HashInfo::GetStrNonCryptoHash "$R0" "$R1"
  Pop $0
  DetailPrint "   Hash Alghoritm: $R0"
  DetailPrint "   Input String: $R1"
  DetailPrint "   Output Hash: $0"
  1b. Compute the Non-Cryptographic Hash value for a given FILE

  ; Usage
  ; HashInfo::FunctionName "PARAM1" "PARAM2"
       ; PARAM1 -> Hash Algorithm (Obligatory)
       ; PARAM2 -> Full Path to File (Obligatory)
       ; Notes:
       ; - Function returns "error" if something goes wrong

  StrCpy $R0 "Bernstein"   ; PARAM1
  StrCpy $R1 "$EXEPATH"  ; PARAM2
  HashInfo::GetFileNonCryptoHash "$R0" "$R1"
  Pop $0
  DetailPrint "   Hash Alghoritm: $R0"
  DetailPrint "   Input File: $R1"
  DetailPrint "   Output Hash: $0"

2.4. CRYPTOGRAPHIC HASH FUNCTIONS

Cryptographic hash functions are a special class among hash functions that aim to provide certain security guarantees. For example, when obtaining a device fingerprinting, you should use a cryptographic hash function to have more guarantees of its output uniqueness. The ideal cryptographic hash function has six main properties:

  • Deterministic: the same message always results in the same hash
  • Quick: it is quick to compute the hash value for any given message
  • One-way function: it is infeasible to generate a message from its hash value except by trying all possible messages
  • Avalanche effect: a small change to a message should change the hash value so extensively that the new hash value appears uncorrelated with the old hash value
  • Collision resistant: it is infeasible to find two different messages with the same hash value
  • Pre-image attack resistant: a pre-image attack on cryptographic hash functions tries to find a message that has a specific hash value. A cryptographic hash function should resist attacks on its pre-image.

Available Hash Algorithms:
MD2, MD4, MD5, SHA0, SHA1, SHA2-224, SHA2-256, SHA2-384, SHA2-512, SHA2-512/224, SHA2-512/256, SHA3-224, SHA3-256, SHA3-384, SHA3-512, Blake2B-160, Blake2B-256, Blake2B-384, Blake2B-512, Blake2BP, Blake2S-128, Blake2S-160, Blake2S-224, Blake2S-256, Blake2SP, Blake3, GOST 34.11-94, GOST R 34.11-2012-256, GOST R 34.11-2012-512, Grindahl-256, Grindahl-512, Has160, RIPEMD, RIPEMD-128, RIPEMD-160, RIPEMD-256, RIPEMD-320, Snefru-128, Snefru-256, Panama, RadioGatun32, RadioGatun64, Keccak-224, Keccak-256, Keccak-288, Keccak-384, Keccak-512, WhirlPool

  1a. Compute the Cryptographic Hash value for a given STRING

  ; Usage
  ; HashInfo::FunctionName "PARAM1" "PARAM2"
       ; PARAM1 -> Hash Algorithm (Obligatory)
       ; PARAM2 -> String (Obligatory)
       ; Notes:
       ; - Function returns "error" if something goes wrong

  StrCpy $R0 "MD5"           ; PARAM1
  StrCpy $R1 "Hello World" ; PARAM2
  HashInfo::GetStrCryptoHash "$R0" "$R1"
  Pop $0
  DetailPrint "   Hash Alghoritm: $R0"
  DetailPrint "   Input String: $R1"
  DetailPrint "   Output Hash: $0"
  1b. Compute the Cryptographic Hash value for a given FILE

  ; Usage
  ; HashInfo::FunctionName "PARAM1" "PARAM2"
       ; PARAM1 -> Hash Algorithm (Obligatory)
       ; PARAM2 -> Full Path to File (Obligatory)
       ; Notes:
       ; - Function returns "error" if something goes wrong

  StrCpy $R0 "MD5"         ; PARAM1
  StrCpy $R1 "$EXEPATH" ; PARAM2
  HashInfo::GetFileCryptoHash "$R0" "$R1"
  Pop $0
  DetailPrint "   Hash Alghoritm: $R0"
  DetailPrint "   Input File: $R1"
  DetailPrint "   Output Hash: $0"


3. DOWNLOAD



NSIS HASHINFO PLUGIN
Cryptographic functions for generating Hash - NSIS HashInfo 2.0.0.0 Plugin (32/64-Bit UNICODE)


NSIS HashInfo Plugin (32/64-Bit Unicode)


Release Date: November 4, 2022 (Downloaded: 245 times)
Version: 2.0.0.0
Architecture: Windows (NSIS 32/64-Bit Unicode)
License: Freeware
Copyright: Copyright © 2016 - 2024 Paweł Porwisz
File Size: 1,10 MB (1161145 bytes)
Hash (SHA256): 6d0413a4269db52fef7b20fcf66590618b4536090bdddbcbd588490559ae7a5d





4. LICENSE

NSIS HashInfo Plugin

Copyright © 2016 - 2024 Paweł Porwisz
All rights reserved


INSTALLATION OR USE OF THE NSIS PLUGIN INDICATES YOUR ASSENT TO THE FOLLOWING LICENSE AGREEMENT.


THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.