× 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.



Hi there,

I am trying to to use the MD5 function to store/check passwords, but things
aren't working as expected. Or, to put it better, they work as expected but
only once.

The second time the cipher function is invoked in the same program
execution, it will generate a MCH5601 exception, and be done with it. First
time works perfectly, but the second will always fail.

I declare the procedures I am using:

Dcvthc PR EXTPROC('cvthc')
D 1
D 1
D 10i 0 VALUE

DCipher PR EXTPROC('_CIPHER')
D * VALUE
D * VALUE
D * VALUE
I declare the control ds and work variables (as seen in
http://archive.midrange.com/midrange-l/200006/msg01334.html)

DControls     DS
D Function      5i  0 inz(5)
D HashAlg       1     inz(x'00')
D Sequence      1     inz(x'00')
D DataLngth     10i 0
D Unused        8     inz(*LOVAL)
D HashCtxPtr    *     inz(%addr(HashWorkArea))
DHashWorkArea S 96    inz(*LOVAL)
DDestinoHex   S 16
DDestinoChr   S 32
DDestinoPtr   S *     inz(%addr(DestinoHex))
DFuentePtr    S *     inz(%addr(Fuente))
DFuente       S 8
I check against user provided password (CONTRA) against the one stored (
USER.CONTRA, already stored in DB)

dow CONTRA <> USER.CONTRA;
  exFmt AskForPass;
  fuente    = CONTRA;
  DataLngth = %len(%trimr(fuente));
  Cipher(%addr(DestinoPtr) : %addr(Controls) : %addr(FuentePtr));
  CVTHC(DestinoChr : DestinoHex :%size(DestinoChr));
endDo;

If the user puts his/her password correctly in the first attempt, things go
on and everything is nice. Otherwise, he gets another chance, and then the
program will fail (right or wrong password, it doesn't matter) giving error
message MCH5601, reason code X'0000'.

I tried to find clues at
http://publib.boulder.ibm.com/iseries/v5r1/ic2924/tstudio/tech_ref/mi/CIPHER.htm
but
it didn't help.

Anyone has a deeper insight on this?

Regards,

I.-

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.