|
Have you checked the MI400 archives? I want to think we've hit this once or twice, but not lately.... Have you looked at Leif's MI ebook? Don in DC > 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.- > -- > This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list > To post a message email: RPG400-L@xxxxxxxxxxxx > To subscribe, unsubscribe, or change list options, > visit: http://lists.midrange.com/mailman/listinfo/rpg400-l > or email: RPG400-L-request@xxxxxxxxxxxx > Before posting, please take a moment to review the archives > at http://archive.midrange.com/rpg400-l. > >
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.