Openssl-使用命令行的 SHA256(Base-64)

Openssl-使用命令行的 SHA256(Base-64)

我必须将字符串的哈希总数添加到文件中。哈希总数是 SHA-256 (Base-64)。

字符串流如下:

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

当我使用以下命令进行哈希总计时

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

它给出的值如下:

SqL7nAwQ/Y+2LXXfLaX25CtfSjoShY9+FCRZp5jcGO0=

但是当我将其发送给对方时,解密后他们收到了错误的信息:

他们期望上述示例消息的加密字符串如下

1EjGezzIXFT+/QvXUuK1juo8rUJGuymRmUnXgA8OzA8=

有人能帮我看看这里出了什么问题吗?我希望值与另一方输出相同。

相关内容