I am generating the SHA256 of the following string
{
"billerid": "MAHA00000MUM01",
"authenticators":
[
{
"parameter_name": "CA Number",
"value": "210000336768"
}
],
"customer":
{
"firstname": "ABC",
"lastname": "XYZ",
"mobile": "9344895862",
"mobile_alt": "9859585525",
"email": "[email protected]",
"email_alt": "[email protected]",
"pan": "BZABC1234L",
"aadhaar": "123123123123"
},
"metadata":
{
"agent":
{
"agentid": "DC01DC31MOB528199558"
},
"device":
{
"init_channel": "Mobile",
"ip": "124.124.1.1",
"imei": "490154203237518",
"os": "Android",
"app": "AGENTAPP"
}
},
"risk":
[
{
"score_provider": "DC31",
"score_value": "030",
"score_type": "TXNRISK"
},
{
"score_provider": "BBPS",
"score_value": "030",
"score_type": "TXNRISK"
}
]
}
I am getting different SHA256 output from different sources. This website: https://www.freeformatter.com/sha256-generator.html#ad-output calculates the SHA256 of the above string: 053353867b8171a8949065500d7313c69fe7517c9d69eaff11164c35fcb14457
This website(https://emn178.github.io/online-tools/sha256.html) gives the SHA256 as eae5c26759881d48a194a6b82a9d542485d6b6ce96297275c136b1fa6712f253
I am using CryptoJs library in Javascript to calculate SHA256 which also gives eae5c26759881d48a194a6b82a9d542485d6b6ce96297275c136b1fa6712f253 this result.
I want the SHA256 calculated to be: 053353867b8171a8949065500d7313c69fe7517c9d69eaff11164c35fcb14457
Why these is difference in SHA256 calculation over different places?
afollowed by abon a separate line is reproducible byprintf "a\r\nb" | shasum -a 256(freeformatter) orprintf "a\nb" | shasum -a 256(github)