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



Missing


DInput S 32000
DptrInput S * Inz(%Addr(Input))

DOutput S 20
DptrOutput S * Inz(%Addr(Output))



On 12/29/2015 04:14 PM, Raul A Jager W wrote:
I use a pair of routines, here is a copy. They work great.
_____________________________________________________________________

// RPG Service Program: MD5R
// Create an MD5 hash for a given piece of data (aka message or digest
//
//
// Compile Notes
// 1. CRTRPGMOD
// 2. CRTSRVPGM SRVPGM(MYLIB/MD5R) EXPORT(*ALL)
//
HNOMAIN OPTION(*SRCSTMT:*NODEBUGIO)
DCipher PR EXTPROC('_CIPHER')
D * VALUE
D * VALUE
D * VALUE
Dcvthc PR EXTPROC('cvthc')
D 1
D 1
D 10i 0 VALUE

DdsControls DS 96
D Function 5U 0 Inz(5)
D HashAlgorithm 1 Inz(x'01')
D Sequence 1 Inz(x'00')
D DataLength 10U 0
D OutputType 1 Inz(x'00')
D Reserved1 7 Inz(*ALLx'00')
D ptrHashContext * Inz(%Addr(HashWorkArea))
DHashWorkArea S 96 Inz(*LOVAL)
DOutputHex S 40


______________________________________________________________________
// Return a hash as a 16-byte binary value
PMD5Hash_BINARY B Export
DMD5Hash_BINARY PI 16
D parmInput 32000 Options(*VarSize) Const Varying

/Free
HashAlgorithm = x'00';
HashWorkArea = *LOVAL;
DataLength=%Len(parmInput);
Input=parmInput;
Cipher(%Addr(ptrOutput):
%Addr(dsControls):
%Addr(ptrInput));

Return Output;
/End-Free
P E
______________________________________________________________________

// Return a hash as a 32-byte character value (hex)
PMD5Hash_HEX B Export
DMD5Hash_HEX PI 32
D parmInput 32000 Options(*VarSize) Const Varying


/Free
Output=MD5Hash_Binary(parmInput);
// Convert hash string to character
cvthc(OutputHex:
Output:
%Size(OutputHex));

Return OutputHex;
/End-Free
P E
_____________________________________________________________________________________

On 12/29/2015 03:14 PM, Jack Tucky wrote:
I'm using Qc3CalculateHash to calculate an MD5 Hash. The sample program
uses QDCXLATE to translate from EBCDIC to ASCII, then uses CVTHC to convert
the hash to hex to DSPLY.

The website that I'm talking to gives an example to try and calculate:

The "Salt" value is mJpSl0hTtf71gdV6kAdf

The value to hash is HCO-LAKEW-938^123456^1424480303^12.24^USD

So I try to hash
mJpSl0hTtf71gdV6kAdfHCO-LAKEW-938^123456^1424480303^12.24^USD

I get this:

FAC0532F9A64B2C672571473750A4EA1105CD386

The web example gets this:

3cae2d6436cc7c8fcd43c9e98506056b

Here is their sample code

HMAC-MD5(transaction-key, "x_login^x_fp_sequence^x_fp_
timestamp^x_amount^x_currency_code")

This website gets a different result!
http://www.miraclesalad.com/webtools/md5.php
297f86eb7a335339ddef7194e70d4f27

I've tried the other hash types for the API, none of them match.

Code used here.....

http://www.mysamplecode.com/2011/05/rpgle-generate-sha-1-hash-use.html

Any ideas what I'm doing wrong?

-- Este e-mail fue enviado desde el Mail Server del diario ABC Color --
-- Verificado por Anti-Virus Corporativo Symantec --


-- Este e-mail fue enviado desde el Mail Server del diario ABC Color --
-- Verificado por Anti-Virus Corporativo Symantec --

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.