Legato
Legato

GoFiler Legato Script Reference

 

Legato v 1.5b

Application v 5.24b

  

 

Chapter FiveGeneral Functions (continued)

5.18 Hash Functions

5.18.1 Overview

A hash function is any function that can be used to map digital data of arbitrary size to digital data of fixed size. The values returned by a hash function are called hash code (aka as hash values, hash sums, or simply hashes). One practical use is to hash a string and later use that code to compare or validate another string as a password or signature. Another example is a data structure called a hash table which is widely used in computer software for rapid data lookup. Hash functions accelerate table or database lookup by detecting duplicated records in a large file.

Hashing IS also useful in cryptography. A cryptographic hash function allows one to easily verify that some input data matches a stored hash value, but makes it hard to construct any data that would hash to the same value or find any two unique data pieces that hash to the same value. This principle is used by the PGP algorithm for data validation and by many password checking systems.

Hash functions are related to (and often confused with) checksums, check digits, fingerprints, randomization functions, error-correcting codes, and ciphers. Although these concepts overlap to some extent, each has its own uses and requirements and is designed and optimized differently.

Legato provides a number of embedded SDK hash functions and of course programmers can develop their own.

5.18.2 Basic Functions

Legato provides for a simple hash based on the DJB2 algorithm.

Summary of hash functions:

HashString — Creates a hash using the DJB2 algorithm.

5.18.3 MD5 Functions

The MD5 message-digest algorithm is a widely used cryptographic hash function producing a 128-bit (16 byte) hash or digest value, typically expressed in text format as a 32 digit hexadecimal number. MD5 has been utilized in a wide variety of cryptographic applications and digital signatures and is also commonly used to verify data integrity.

MD5 is no longer considered a secure digest method and should be employed for light security or compatibility functions.

Legato MD5 output is always returned as an ASCII presentation of the 16 byte hash. For example:

11ed5eabdbf71fd1a0a41c408ee1e11d

or

f82ea9971b59f4d5e088cfbebbf617e7

 

The MD5 functions allow strings, buffers of characters and files to be encoded. There are options to perform encoding in a single operation or to open an MD5 object and then feed buffers of data and eventually retrieve a digest.

Summary for MD5 functions:

MD5CreateDigest — Creates an MD5 from a string or file. Returns a hex string.

MD5NewDigestObject — Creates a running MD5 digest object.

MD5AddToDigest — Adds data to a running MD5 digest.

MD5FinishDigest — Finishes a running MD5 digest object.