I have to add hash total of a string to a file. Hash total is SHA-256 (Base-64).
String stream would be as 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 for future use|Creation Date / Time|Payment Details|Bank to Bank Info|Payment Charges|Ordering Customer|File Origination Code|Resereved for future use|Charge account|Resereved for future use|Resereved for future use|Resereved for 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 i do hash total with below command
echo -n $txt | openssl dgst -binary -sha256 | openssl base64
it gives value as below:
SqL7nAwQ/Y+2LXXfLaX25CtfSjoShY9+FCRZp5jcGO0=
But when i send it to the other party they are getting wrong information after decrypt:
They are expecting below encrypted string for the above sample message
1EjGezzIXFT+/QvXUuK1juo8rUJGuymRmUnXgA8OzA8=
Can anyone please help me what is wrong here ? I want value to be same as the other party output.
"$txt"
instead of$txt
? Otherwise the shell may be splitting it at the newline (and possibly performing glob expansions, if it contains special characters)