Sample Header Ad - 728x90

Remove newline character after pipe

1 vote
1 answer
2285 views
I want to do Base64 encode with a command echo -en "my_message" | openssl sha1 -hmac "secret_key" | base64 The output string of openssl is as expected, but the output of base64 is not as the output from openssl has a new line character. If I run the command echo -en "my_message" | openssl sha1 -hmac "secret_key" | xargs echo -n | base64 Then the final output is correct. I wonder if there is a more elegant way for this command
Asked by Dino Tw (111 rep)
Mar 26, 2020, 07:34 AM
Last activity: Jul 14, 2025, 12:02 PM