Questions tagged [base64]

Questions about encoding/decoding file or stdin by using base64

Filter by
Sorted by
Tagged with
0 votes
3 answers
104 views

Replace a timestamp Base64 value in a file

I have a problem, I have a file test.txt that has a content like this: dn: serv=CSPS,mscId=167e48dc2b7a42d4acce611c8b477262,ou=multiSCs,dc=three structuralObjectClass: CP1 objectClass: CP1 objectClass:...
user avatar
-1 votes
1 answer
94 views

base64: invalid input error when trying to decode contents of yaml file

What specific syntax must be changed in the bash below to successfully decode the base64 encoded value which is throwing the error below? THE ERROR: The following 3 simple commands are typed into the ...
user avatar
  • 5,074
3 votes
4 answers
240 views

Replace a base64 value in a file in unix

I have a problem, I have a file test.txt that has a content like this: objectClass: CPM1 objectClass: CPM2 objectClass: CPM3 objectClass: CPM4 objectClass: CPZ objectClass: CP04s objectClass: CP0A ...
user avatar
0 votes
0 answers
23 views

Is it possible to convert all files to Base64 at the same time via `pandoc` when exporting to a new sinle HTML file?

I know to convert any files to Base64, but it is manually at hand on the terminal. It's tiring to convert each file to base63 via terminal, copy and paste each code to the combined file exported from ...
user avatar
2 votes
1 answer
266 views

running base64 encoded bash script gives me error

I have a bash script; the script is to generate a random number and have the user guess it. printf 'Guess the number (1-10) : ' read -r n randint=$(( ( RANDOM % 10 ) + 1 )) if [ $n = $randint ]; then ...
user avatar
0 votes
0 answers
88 views

mutt & attachment encoding

So, I have a simple bash script that is intended to send a note to a user (say, the fictitious fflintstone@bedrock.com), where said note contains a short snippet of text (contained in the file message....
user avatar
-1 votes
1 answer
67 views

Can't encode this string [duplicate]

I'm doing a simple exercise where copy a base64 encoded cookie value, and then make a few changes and then re-encode, and then use the result to log into a site as admin. I have the following encoded ...
user avatar
1 vote
0 answers
96 views

String RSA Encrypt with Public Key in bash?

I want to crypt a String with bash, Example: (No longer i using this keys after sharing. D'ont worry about this.) ~/.myprogram.publickey.txt ...
user avatar
4 votes
2 answers
298 views

Difference between wc -c and ${#}?

I've created script, where I encoded string 28 times with base64. Then I wanted to echo count of chars in outputted string. First I used ${#var} which gave me 34070. Then I tried on the same string ...
user avatar
12 votes
3 answers
10k views

base64 -d decodes, but says invalid input

Does anybody know why this is happening and how to fix it? me@box:~$ echo "eyJmb28iOiJiYXIiLCJiYXoiOiJiYXQifQ" | base64 -di {"foo":"bar","baz":"bat"}...
user avatar
  • 285
1 vote
1 answer
351 views

Base64 Encoding Not Producing The Required Encoded Value

I am trying to base 64 encode the following information: { "expiration": "2015-12-30T12:00:00.000Z", "conditions": [ {"bucket": "sigv4examplebucket&...
user avatar
  • 151
-2 votes
1 answer
554 views

Sending email attachments in plain text format instead of base64

I need to send an email. The requirements are as follows: Plain text and not HTML (Message type) Plain text and not base64 (Attachments, given that my attachments are all ASCII text files.) How do I ...
user avatar
0 votes
2 answers
4k views

How to properly encode string based on json file?

I have the following basic.json file: { "user": "user", "pass": "password" } I'm trying to encode it in base64 like this: "Basic dXNlcjpwYXNzd29yZA==" I think I'm close: echo Basic $(echo ...
user avatar
1 vote
0 answers
812 views

Remove newline character after pipe

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 ...
user avatar
  • 111
1 vote
1 answer
2k views

Read from stdin and pipe to next command

I would like to read a password from stdin, suppress its output and encode it with base64, like so: read -s|openssl base64 -e What is the right command for that?
user avatar
0 votes
1 answer
9k views

Can you search for base64 with grep?

Is it possible to search for Base64 strings with grep? Say I have a list of text files and I want to find all the Base64 strings contained in them; is there any way to search for them? I mean I know ...
user avatar
  • 4,039
0 votes
3 answers
3k views

Why does converting from base64 and back garble the end of this string?

Command: echo "HelloWorld==" | base64 -d | base64 Output: HelloWorlQ== Why is my d now a Q? Edit: I am not trying to start with arbitrary data and base64 encode it. My intention is to start ...
user avatar
-5 votes
2 answers
5k views

The following text is encoded in base 64. How do I decode it and get the answer?

Ik5ldmVyIHRydXN0IGEgY29tcHV0ZXIgeW91IGNhbid0IHRocm93IG91dCBhIHdpbmRvdyIgLSBTdGV2ZSBXb3puaWFr How do I decode this and get the answer?
user avatar
  • 1
1 vote
2 answers
150 views

Unexpected grep behaviour when using command substituiton

I'm trying to find and print out all the files that contain a base64 encoded string, using grep and command substitution. If I first encode the base64 string, and then grep, I'm able to find the file:...
user avatar
  • 121
1 vote
1 answer
252 views

How can I source a base 64 encoded file in bash?

Is there a way to source a base64 encoded file in bash instead of doing this? cat $DIR/data/saves/$savegame | base64 --decode > $DIR/data/saves/$savegame.decoded . $DIR/data/saves/$savegame....
user avatar
-4 votes
1 answer
372 views

For base64 encoding/decoding, can base64 and uuencode/uudecode be used exchangeably?

Do both base64 (from coreutils) and uuencode -m and uudecode (from sharutils) implement base64 encoding and decoding? Can they be used exchangeably?
user avatar
  • 89.8k
-1 votes
1 answer
220 views

Bash: Is it better to echo or <<<? [closed]

When passing input, which method is better? > echo 'test' | base64 dGVzdAo= > base64 <<< 'test' dGVzdAo= With variables as well, which method should be use? > t='test' > ...
user avatar
0 votes
1 answer
2k views

How to decode base64 text in ldif file in Linux?

I need to decode base64 embedded in ldif (openldap) backups. I found here a way to join lines starting with a blank. Then, based on this question about "How to decode base64 text in xml file in ...
user avatar
  • 131
7 votes
1 answer
19k views

How do you convert a base64 utf-8 encoded string to a binary file from bash?

Is there a tool that will do this in bash?
user avatar
  • 4,039
7 votes
3 answers
25k views

What's the right way to base64 encode a binary file on CentOS 7?

I'm using CentOS 7 with bash shell. I thought base64-encoding a binary file would be as simple as [rails@server lib]$ cat mybinary.file | base64 > /tmp/output.base64 However, I notice when I ...
user avatar
  • 1,810
0 votes
2 answers
2k views

How can the, encrypted with AES, and BASE64 encoded, SSH private key, have size smaller than specified?

This might be obvious to some, but I wonder, if I generated 8192 key in size with: ssh-keygen -t rsa -b 8192 How can the, encrypted with AES, and BASE64 encoded, SSH private key, have size smaller ...
user avatar
-1 votes
1 answer
64 views

is there a Base64-based dist?

Is there a Linux distribution or Unix version where everything is Base64 encoded in memory? I'm interested in the concept of being able to dump the entire system state and print it as a book.
user avatar
  • 7
4 votes
1 answer
2k views

Javascript BTOA vs base64 in bash?

I need to convert a username and password combination into base64 before sending to an API. The javascript BTOA function is working for me, but when I try to use base64 command in bash I get slightly ...
user avatar
1 vote
2 answers
808 views

Using Linux, how would I find an image stored in base64 locally? [closed]

I've been given a project handled by a former coder in our organization. It's a php based application and it is Massive (as in tons of files everywhere). I'm trying to find a logo that's stored......
user avatar
0 votes
1 answer
1k views

openssl decoding does not work with echo

I encrypted some data: echo -n aaaa | openssl enc -aes-128-ecb -K E5E9FA1BA31ECD1AE84F75CAAA474F3A -nosalt -out o This decodes it correctly: base64 o | openssl enc -d -aes-128-ecb -K ...
user avatar
  • 511
0 votes
2 answers
5k views

Concatenate 2 binary strings in base64 form

I have two BASE64 encoded strings and I would like to get the BASE64 encoding of the binary concatenation of the two string using just the command line. Example: > $ echo -n "\x01\x02" |base64 ...
user avatar
  • 271
0 votes
1 answer
1k views

Base64 decode and overwrite file

I have a file which contains base64 encoded image data: ~/dog/1.jpg I put it there via SSH, and base 64 encoded the data so it would be safe to transfer in the terminal. Assume the base64 image data ...
user avatar
2 votes
1 answer
104 views

What is the point of hashing?

I was looking at my companies hashing implementation and I saw that the passwords for the root user are stored in base64 encoding. What is to stop anyone from simply copying the password and doing a ...
user avatar
3 votes
1 answer
2k views

bash: how do I write base64-encoded content into a file to specified line

I'm working on an "edgemax feature-wizard" which is kind of a plugin system. There are only three files allowed in a plugin tarball: a bash script as backend, a HTML file as frontend and a validation....
user avatar
1 vote
1 answer
400 views

How can I decrypt back a base64 encoded shaX binary string?

For the encrypted base64 encoded SHAX strings, what command can decrypt it back to original string, thanks
user avatar
  • 38.2k
14 votes
1 answer
17k views

Can OpenSSL decode base64 data that does not contain line breaks?

I have two chunks of base64 data in a bash variable. The usual line breaks within the base64 data have been replaced by spaces and the variable is basically one very long one-line string. I can ...
user avatar
  • 6,648
5 votes
3 answers
3k views

Is it possible to convert linux salted sha512 password hash to LDAP format?

We have an LDAP server which stores passwords and other user data. The server is not used for authentication of client machines though but only for authentication of client apps. So users change their ...
user avatar
5 votes
3 answers
7k views

How do I decode a list of base64-encoded file names?

I have a list of base64-encoded file names in the pattern of {base64-encoded part here}_2015-11-12.pdf. I'm trying to decode that list of files and return it on the command line as another list, ...
user avatar
  • 303
6 votes
1 answer
4k views

How to extract first base64 code out of file?

On Linux I'm having text files and each contains 1 or 2 base64 blocks of code. Following is part of the file and 1 base64 block. Content-Transfer-Encoding: base64 ...
user avatar
  • 189
1 vote
0 answers
3k views

curl --data-urlencode and underscores

I've been using curl -XPOST to post some links to a Telegram channel via a bot api/key, the urls are in form of https://site/x/pre_encoded_string, where pre_encoded_string is in form (real samples) ...
user avatar
  • 111
2 votes
1 answer
9k views

Apply SHA256 and Base64 to string in script

I'm trying to apply SHA256 and then Base64 encode a string inside a shell script. Got it working with PHP: php -r 'echo base64_encode(hash("sha256", "asdasd", false));'. But I'm trying to get rid of ...
user avatar
1 vote
4 answers
6k views

How to decode base64 text in xml file in Linux?

I'm new in linux (shell). I need to decode base64 text in xml file using linux shell script. Could you please help me to write linux shell script for decoding the values of those tags where attribute ...
user avatar
5 votes
1 answer
1k views

What is this seemingly base64 data set by setfattr?

I have written a short shell script that simply wraps setfattr in a slightly more convenient form for setting the extended attribute that corresponds to a free-text comment: #!/bin/sh test "$2" &&...
user avatar
  • 26.3k
0 votes
1 answer
988 views

base64 encoded e-mails and compression

I sent an e-mail which included almost 2500 characters of text and one attached 60KiB PNG file. This text included number 185 eight times. However, after the e-mail was encoded to base64 and sent, I'm ...
user avatar
  • 6,268
0 votes
1 answer
3k views

Extracting a file attachment from an email message and saving it to a file?

I have an email stored in plaintext (yes, headers, messages, attachments, everything in one plaintext file) and I'd like to extract a PDF document from it. I've copied the base64-encoded text, then ...
user avatar
  • 35.5k
43 votes
5 answers
40k views

How can I get a base64 encoded shaX on the cli?

sha1sum outputs a hex encoded format of the actual sha. I would like to see a base64 encoded variant. possibly some command that outputs the binary version that I can pipe, like so: echo -n "message" |...
user avatar
2 votes
2 answers
4k views

How can I check the Base64 value for an integer?

I would like to check the Base64 value for an integer. There is a base64 linux command but I don't understand how I can apply it on integers. I have tried with base64 10 but then I get the error ...
user avatar
  • 1,583