|
Publicité ' | |||||||||||||||||||||||
|
|
#1 |
|
Invité de passage
![]() Responsable de service informatique Inscription : janvier 2012 Messages : 1 ![]() |
Bonjour,
Après mise en œuvre de cet API voir + bas le résultat obtenu est différent des modules de vérification existant sur le web (https://secure.ogone.com/ncol/test/testsha_utf8.asp) Quelqu'un a t'il dejà mis cette API en prod ? ou avez vous une idée sur les raisons de cette différence d'encodage RPGLE Sample Code to Generate SHA-1 Hash You can also use it to HASH MD5, SHA256, SHA384, SHA512 h DFTACTGRP(*NO) ACTGRP('AS') BNDDIR('QC2LE') debug d Qc3CalculateHash... d PR ExtProc('Qc3CalculateHash') d InData * value d IndataL 10i 0 const d InDataF 8a const d AlgoDes 16a const d AlgoFmt 8a const d CryptoSP 1a const d CryptoDev 1a const options(*omit) d Hash 64a options(*varsize:*omit) d ErrorCode 32767a options(*varsize) d ALGD0500_t ds qualified d based(Template) d HashAlg 10i 0 d QDCXLATE PR ExtPgm('QDCXLATE') d len 5p 0 const d data 32702a options(*varsize) d table 10a const d cvthc PR ExtProc('cvthc') d target 65534A options(*varsize) d src_bits 32767A options(*varsize) const d tgt_length 10I 0 value d ErrorNull ds qualified d BytesPro 10i 0 inz(0) d BytesAvai 10i 0 inz(0) d HASH_MD5 c 1 d HASH_SHA1 c 2 d HASH_SHA256 c 3 d HASH_SHA384 c 4 d HASH_SHA512 c 5 d data s 2000A d len s 10i 0 d alg ds likeds(ALGD0500_t) d bin s 20a d $hex s 40a /free len = %len(%trimr(data)); alg.HashAlg = HASH_SHA1; //Set the HASH Algorithm you want to use ! //Convert from EBCDIC to ASCII (skip this step if you want Hash in EBCDIC) QDCXLATE(len: data: 'QTCPASC'); //API to calculate the SHA1 hash Qc3CalculateHash( %addr(data) : len : 'DATA0100' : alg : 'ALGD0500' : '0' : *OMIT : bin : ErrorNull ); //Convert to HEX cvthc( $hex: bin: %len(bin)*2); dsply $hex; *inlr = *on; /end-free |
|
|
00
|
|
|
#2 |
|
Membre régulier
![]() Inscription : octobre 2006 Messages : 115 ![]() |
Bonjour,
Il y a un truc qui me chagrine... Tu convertis la chaîne en ASCII (QDCXLATE...). Tu l'encodes, et tu affiches le résultat à l'écran. Et ton écran, il est codé en quoi ? EBCDIC... A moins que je fasse erreur. |
|
|
00
|
Copyright © 2000-2012 - www.developpez.com