Openssl - SHA256 (Base-64) using command line -


i have add hash total of string file. hash total sha-256 (base-64).

string stream below:

 transaction type|external system reference number|original external system reference|account title|sap company number|payment currency|payment amount|trade / posting date|settlement date|client account (sap)|client number (sap)|benficiarys bank sort code|beneficiarys bank swift code|beneficiarys bank line 1|beneficiarys bank line 2|intermediary bank|intermediary swift code|fx rate|beneficiary customer|beneficiary account number|beneficiary’s bank country|resereved future use|creation date / time|payment details|bank bank info|payment charges|ordering customer|file origination code|resereved future use|charge account|resereved future use|resereved future use|resereved future use fcyout|testref000101||a company limited|gb0010001|eur|0000000663.75|20130327|20130402|10000001|90023562||sbzazajjxxx|standard bank joburg|sandton joburg||||john smith|1010102356|za||20130327163043|invoice 23b|branch code 234234|sha||xxxx||||| 

when hash total below command

echo -n $txt | openssl dgst -binary -sha256 | openssl base64 

it gives value below:

sql7nawq/y+2lxxflax25ctfsjoshy9+fcrzp5jcgo0= 

but when send other party getting wrong information after decrypt:

they expecting below encrypted string above sample message

1ejgezzixft+/qvxuuk1juo8rujguymrmunxga8oza8= 

can please me wrong here ? want value same other party output.

encoding utf8 , there no line delimiter. here's c# code use test:

sha256 sha = new sha256managed(); stringbuilder sbtest = new stringbuilder(); sbtest.append("transaction type|external system reference number|original external system reference|account title|sap company number|payment currency|payment amount|trade / posting date|settlement date|client account (sap)|client number (sap)|benficiarys bank sort code|beneficiarys bank swift code|beneficiarys bank line 1|beneficiarys bank line 2|intermediary bank|intermediary swift code|fx rate|beneficiary customer|beneficiary account number|beneficiary’s bank country|resereved future use|creation date / time|payment details|bank bank info|payment charges|ordering customer|file origination code|resereved future use|charge account|resereved future use|resereved future use|resereved future use"); sbtest.append("fcyout|testref000101||a company limited|gb0010001|eur|0000000663.75|20130327|20130402|10000001|90023562||sbzazajjxxx|standard bank joburg|sandton joburg||||john smith|1010102356|za||20130327163043|invoice 23b|branch code 234234|sha||xxxx|||||");  string str = sbtest.tostring(); byte[] data = sha.computehash(encoding.utf8.getbytes(str)); stringbuilder sbuilder = new stringbuilder(); (int = 0; < data.length; i++) {     sbuilder.append(data[i].tostring("x2")); }  string base64string = convert.tobase64string(data); console.writeline(base64string); 

Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -