These 2 variables will have the same visible content
x_sign1="aabbccdd_and_somthing_else"
var1="...."
[........]
x_sign2=$(echo -n "${var1}${var2}${var3}" | shasum -a 256)
echo $x_sign2
====>
aabbccdd_and_somthing_else -
Note the "-" in the end.
However, their lengths will be different. Even though the x_sign2
doesn't contain a new line symbol. To ensure this:
x_sign22=$(echo -n "${var1}${var2}${var3}" | shasum -a 256 | tr -d '\n')
But:
echo ${#x_sign1}
====> 64
And:
And:
echo ${#x_sign2}
====> 67
echo ${#x_sign22}
====> 67
The difference is 3 symbols. The visible content is identical.
Also, when I make a request via curl to a REST API which needs that value of a signature, x_sign1
always succeeds, whereas x_sign2
doesn't -- "wrong signature"
Why? How to fix that?