Welcome Guest | My Membership | Login

IS.HASH.MD5 Generating MD5 Values with Generic MultiValue BASIC


Article

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

While not as secure as SHA1, it is still used in many places for data integrity, version control, and other features that need unique one-way signatures.

MD5 Function

MD5 processes a variable-length message into a fixed-length output of 128 bits. The input message is broken up into chunks of 512-bit blocks (sixteen 32-bit words); the message is padded so that its length is divisible by 512. The padding works as follows: first a single bit, 1, is appended to the end of the message. This is followed by as many zeros as are required to bring the length of the message up to 64 bits fewer than a multiple of 512. The remaining bits are filled up with 64 bits representing the length of the original message, modulo 264.

MD5("The quick brown fox jumps over the lazy dog")
9e107d9d372bb6826bd81d3542a419d6

MD5 will detect even small changes in the string and cause the returned hash value to change. You can always read more about MD5 at:

https://en.wikipedia.org/wiki/MD5

MultiValue BASIC Hashing

Most versions of MultiValue BASIC do not include built-in hashing functions. This requires developers to create their own. We can use Pure/Generic MultiValue BASIC, but you may see a performance hit depending on how bit math is handled. For hash values like MD5, the performance issues of generic bit math does not seem to be a problem.

Dave Meagher has done all the work to provide hash functions like SHA1 and MD5 in his FOSS4MV/mvCrypt code on BitBucket:

https://bitbucket.org/foss4mv/mvcrypt

The IS.HASH.MD5 program attached to this article used Dave's mvCrypt MD5 code, but formats it so that it is interchangeable with other versions of the IS.HASH.MD5 code on the International Spectrum Website.

Example

MD5.MESSAGE = "The quick brown fox jumps over the lazy dog"
CALL IS.HASH.MD5(SHA1.MESSAGE,HASH.VALUE)
*
TEST.VALUE = "9e107d9d372bb6826bd81d3542a419d6"
CRT HASH.VALUE : " =" : TEST.VALUE :" - "
IF (HASH.VALUE EQ TEST.VALUE) THEN
CRT "Ok"
END ELSE
CRT "Failed"
END

Output

9e107d9d372bb6826bd81d3542a419d6 = 9e107d9d372bb6826bd81d3542a419d6 - Ok 

 

# # #          # # #          # # #

 

Related Articles

  • From the Inside January/February 2017

    Company: International Spectrum

    Let's say you are a rock star or a professional athlete. You have talent. More than that, you are a master of your craft. Performing — onstage or on the playing field — is the practical demonstration of what you can do. Despite the hours you spend playing in public, you are still required to practice, practice, practice in private.

  • Augmented Reality in Business

    Many technological advancements have created new ways of doing business. Some are obvious, like the impact of the spreadsheet or the word processor. With Augmented Reality (AR), the business case is less clear. This article will talk about how Augmented Reality will be used in business and some of what sort of software changes you can expect.

  • Email from U2 Hold Files as PDFs

    Database: UniVerse

    Printing is only one way to share reports. Felix provides code for re-inventing hold files as PDFs and as email.

  • IS.HASH.HMACSHA1: Generating HMAC-SHA1 Values with Generic MultiValue BASIC

    Database: UniData, UniVerse

    The Message Authentication Code (MAC) is a widely used technique for performing message authentication. HMAC (short for "keyed-Hashing for Message Authentication"), a variation on the MAC algorithm, has emerged as an Internet standard for a variety of applications.

  • IS.HASH.MD5 Generating with UniBASIC DIGEST Command

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


Return to top