× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.




Hello,

I try to get a MD5 fingerprint using te programs mentioned in this thread.
http://archive.midrange.com/rpg400-l/200303/msg00008.html

Problem is when using objects bigger than the max. allocation size.
We like to use it for testing member integrity. Members in data files are
often bigger than the maximum %alloc size.

You'll have to modify the program to work the way you want it to. Here's how I'd go about finding out what you need to do:


The first step in doing so is understanding the CIPHER builtin and how it works, since it's the part of the program that calculates the MD5.

To do that, look it up in the Information Center. The Information Center can be found on the Web at the following URL:

http://www.iseries.ibm.com/infocenter

After selecting your region and language, click on the following:

Programming -> APIs -> Related Information -> iSeries Machine Interface Instructions -> CIPHER

Note that CIPHER can do many different functions. Among them is x'0005' which is to create a hash using MD5 or SHA-1. In the example code from the archives, you'll see that there's a DS called 'Controls' and in that DS is a field called function that's set to 5. Now you know why...

Scroll down further and you'll find a section of this web page entitled "Function Identifier 0005" that describes the format of the data that you pass to the CIPHER builtin. It tells you about the 'Controls' data structure from the sample code you found in the archives.

Notice that there's a "Sequence" field that can be set to x'00' for only, x'01' for first, x'02' for middle and x'03' for final. Under the description of that Sequence field, it says the following:

   A hash of data may be performed in one execution of the CIPHER
   instruction or in several which allows the hash of data that does
   not lie in contiguous storage. This is specified using the sequence
   field. When performing the hash in one execution of CIPHER, the
   sequence field should specify only. Otherwise, the first use of the
   CIPHER instruction should specify first, the last use of CIPHER should
   specify final, and any executions of CIPHER in between should specify
   middle. The hash will be returned in the receiver operand when the
   sequence field specifies only or final.

If I understand your question correctly, that's exactly what you're looking for. So, modify the program that you found in the archives so that it passes x'01' in the sequence field for the first chunk of data, x'02' for all of the middle chunks, and x'03' for the last chunk of data that you want to calculate an MD5 hash on.

Note also that the example you found does something that I wouldn't do -- it translates the data to ASCII before performing the MD5 operation. PErsonally, I'd like my MD5 to check the data the way it is. Not translate it to ASCII. But, I guess that's up to you.

Anyway, I hope that helps you...

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.