Carsten,
Having inherited this project, I'm exploring all of the examples I can
find.
You say "some time ago", does that mean in the last 10 years and maybe
a publication you've written for? So yes, I'd certainly like to see that.
Would you post or refer me to your example?
Thanks!
Bill
"CONFIDENTIALITY NOTICE: This e-mail transmission (and/or the attachments
accompanying it) contain confidential information belonging to the sender.
The information is intended only for the use of the intended recipient.
If you are not the intended recipient, you are hereby notified that any
disclosure, copying, distribution or the taking of any action in reliance
on the contents of the information is strictly prohibited. Any
unauthorized interception of this transmission is illegal under the law.
If you have received this transmission in error, please promptly notify
the sender by reply e-mail, and then destroy all copies of the
transmission."
From: "Flensburg, Carsten" <Flensburg@xxxxxxxxxx>
To: "'RPG programming on the IBM i (AS/400 and iSeries)'"
<rpg400-l@xxxxxxxxxxxx>
Date: 03/29/2018 03:28 AM
Subject: RE: MD5R4-SHA256
Sent by: "RPG400-L" <rpg400-l-bounces@xxxxxxxxxxxx>
It appears that the _CIPHER MI instruction does not support the SHA-256
hash algorithm:
https://www.ibm.com/support/knowledgecenter/ssw_ibm_i_73/rzatk/CIPHER.htm
IBM probably decided to focus their effort on the more recent Calculate
Hash (Qc3CalculateHash) API:
https://www.ibm.com/support/knowledgecenter/ssw_ibm_i_73/apis/qc3calha.htm
As documented, the Qc3CalculateHash API supports the MD5 as well as SHA-1
to SHA-512 hash algorithms, and will probably continue to be enhanced, if
and when new algorithms are implemented. Some time ago I wrote a very
simple Calculate Hash Value (CLCHASHVAL) command for the purpose of
demonstrating how to call he Qc3CalculateHash API. The command processing
program could easily be adapted to more specific requirements. If anyone
are interested in a copy, please let me know.
Cheers,
Carsten
-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Vernon
Hamberg
Sent: 29. marts 2018 00:48
To: RPG programming on the IBM i (AS/400 and iSeries)
Subject: Re: MD5R4-SHA256
Raul
Nice use of 2 MI functions - I should have used _CIPHER in my webcast -
for this one, at least, it's a very easy thing to use.
One thought - the Cipher prototype can be specified using standard
variables, maybe like parmInput, instead of using pointers by value - if
possible, it is preferable not to pass pointers by value, since there is
no validation.
Also, you must have the dsControls structure defined somewhere else,
right?
Again, nice example - thanks!
Vern
On 3/28/2018 9:35 AM, Raul Jager wrote:
I use a routine to get sha1, changing the "HashAlgoritm will give you
sha256. (find _CIPER)
// Return a SHA 1 as a 40-byte character value (hex) - input in
EBCDIC
PSHA1 B Export
DSHA1 PI 40
D parmInput 32000 Options(*VarSize) Const Varying
HashAlgorithm = x'01';
HashWorkArea = *LOVAL;
DataLength=%Len(parmInput);
Input=parmInput;
Translate(DataLength: Input: 'QTCPASC');
Cipher(%Addr(ptrOutput):
%Addr(dsControls):
%Addr(ptrInput));
// Convert hash string to character
cvthc(OutputHex:
Output:
%Size(OutputHex));
Return %xlate('ABCDEF': 'abcdef': OutputHex);
PSHA1 E
// procedure to call MI
DCipher PR EXTPROC('_CIPHER')
D
* VALUE D * VALUE
D
* VALUE
On Tue, Mar 27, 2018 at 10:12 AM, <broehmer@xxxxxxxxxxxxxxx> wrote:
Hi All,
I've a need to either change or find a program that does what Scott
Klement's program MD5R4 that creates a SHA1 hash to SHA256.
Anybody know what can be done
with
Scott's program
to make it work?
As an Amazon Associate we earn from qualifying purchases.