Home > Back-end >  Base64 encoding have different values on Windows vs Debian linux
Base64 encoding have different values on Windows vs Debian linux

Time:11-21

I am using OpenSSL to encode base64 string.

On windows:

echo -n "1" | openssl.exe base64 
MQo=

On Debian:

echo -n "1" | openssl base64
MQ==

I get MQo= from Windows, but MQ== from linux.

Does anyone know the reason? and which platform generated the right one?

CodePudding user response:

It may not be OS dependent, according to the explanation given below: Why does a base64 encoded string have an = sign at the end

But the example you've provided the data is the same on both OS.

CodePudding user response:

MQo= means 0x31 0x0a, MQ== means 0x31. Windows echo command does not support -n argument, reference: windows echo

  • Related