decode base64: invalid input
That version will not decode (by default) lines with separators, yet the encoder does that by default. (Newer versions don't have this problem.)
One solution:
base64 -w 0 foo.zip | base64 -d > foo2.zip
Alternate:
base64 foo.zip | base64 -di > foo2.zip
The -i
option stands for (from the man
page):
-i, --ignore-garbage
When decoding, ignore non-alphabet characters.
[...]
Decoding require compliant input by default, use --ignore-garbage to
attempt to recover from non-alphabet characters (such as newlines)
base64 digest- invalid input?
Your data is invalid, probably partial. A valid base64 encoded string should have a length multiple of 4. So the different digest output is expected.
base64 gives incorrect result
echo adds a '\n' ; try echo -n
$ echo -n qwerty | base64
cXdlcnR5
Why doesn't base64_decode return false on invalid input?
Try to do base64_decode("http://www.domain.com/en/messages/list?all=1", TRUE);
The ,TRUE
puts it in "strict mode". Which means it will return FALSE
if the string contains invalid characters.
Related Topics
What Is the Meaning of Question Marks '' in Linux Kernel Panic Call Traces
How to Find All Files with a Filename That Ends with Tilde
Explanation of Convertor of Cidr to Netmask in Linux Shell Netmask2Cdir and Cdir2Netmask
How to Remove X Bytes from the End of a Large File Without Reading the Whole File
Selecting Text in Terminal Without Using the Mouse
Buffered Asynchronous File I/O on Linux
How to Run R Scripts on Servers Without X11
Get the Last 4 Characters of Output from Standard Out
Ffmpeg Split Avi into Frames with Known Frame Rate
How to Retain Docker Alpine Container After "Exit" Is Used
Shell-Init: Error Retrieving Current Directory: Getcwd -- the Usual Fixes Do Not Wor
Given a Linux Username and a Password How to Test If It Is a Valid Account
Difference Between Gnuwin32 and Cygwin
How to Pack Multiple Library Archives (.A) into One Archive File
How to Mount One Partition from an Image File That Contains Multiple Partitions on Linux