[英]base64 gives incorrect result
Because I am setting up vnc server, I need to convert string to base64 to setup password. 因为我正在设置vnc服务器,所以我需要将字符串转换为base64来设置密码。 ( How to setup vnc password
( 如何设置vnc密码
Say, if I want my password to be qwerty
, I have to place the encoded string into the password into conf file. 比方说,如果我想让我的密码为
qwerty
,我必须将编码后的字符串放入密码文件中。
I see there is a base64
utility in Ubuntu. 我看到Ubuntu中有一个
base64
实用程序。 man base64 . 男子base64 。
echo qwerty | base64
echo qwerty | base64
gives cXdlcnR5Cg==
. echo qwerty | base64
给出cXdlcnR5Cg==
。 But this doesn't work. 但这不起作用。
But if I use the online base 64 tool . 但是,如果我使用在线基础64工具 。
qwerty
is encoded to cXdlcnR5
. qwerty
编码为cXdlcnR5
。 This string WILL WORK. 这个字符串将工作。
Question: why the two base64 encode gives different result? 问题:为什么两个base64编码给出不同的结果?
echo adds a '\\n' ; echo添加'\\ n'; try echo -n
尝试echo -n
$ echo -n qwerty | base64
cXdlcnR5
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.