Skip to main content

Questions tagged [base64]

Questions about encoding/decoding file or stdin by using base64

Filter by
Sorted by
Tagged with
0 votes
2 answers
102 views

How to base64 encode/decode accents characters [closed]

I am trying to base64 encode a string which contains accent characters. echo FILE_DATE.Ç | iconv -t utf-8 | base64 But it is giving error iconv: (stdin):1:10: cannot convert locale outputs: LANG= ...
Umesh Kumar's user avatar
2 votes
2 answers
611 views

I used to not need "-i" when using base64

I am using macOs 13.6.1 (22G313) for a machine. I used to be able to base64 a .p12 file (maybe 1 - 3 years ago) using the following format from the terminal: base64 mastercard-track.p12 > ...
Zack Macomber's user avatar
0 votes
1 answer
360 views

How to make base64 print the encoded output after a newline without newline being encoded?

I like to encode with base64 from stdin by invoking the command pasting the input and pressing Ctrl + D twice in order to avoid a trailing newline if I don't want one to be part of the input. It ...
Kalle Richter's user avatar
1 vote
1 answer
543 views

How to decode base64-encoded inline attachments in email files saved from Thunderbird or Gmail?

Although base64 [--decode] works well when encoding and decoding files locally, I can't decode a base64-encoded inline attachment in an eml file saved from Thunderbird or Gmail. I observed that base64-...
Sadi's user avatar
  • 505
8 votes
1 answer
951 views

Why is 0x00 being deleted when assigning a base64 decoded string to a variable

I'm using a Mac. In Bash, I'm trying to decode a base64 string and then try to print the Hex value. I'm using base64 -d command and then assigning it to a variable. myText='YYN29+...
SilleBille's user avatar
0 votes
0 answers
58 views

Google Cloud does not like my Customer-supplied encryption key (CSEK)

I'm trying to encrypt a VM image with my own provided key. So I go to my Terminal emulator and do: $ openssl enc -aes256 -A -P enter aes-256-cbc encryption password: Verifying - ...
mariano-daniel's user avatar
0 votes
2 answers
374 views

Replace a base64 value from file

I have one file which is gets details from ldapsearch command and create file as below # lschuler, people, pl.s2-eu.XXXXXXXXX.local dn: uid=lschuler,ou=people,dc=pl,dc=s2-eu,dc=XXXXXXXXX,dc=local ...
Samurai's user avatar
  • 55
0 votes
1 answer
2k views

Trying to decode base64 from curl, but I get "base64: invalid input"

Trying to decode base64 from curl, but I get "base64: invalid input". ➜ curl -s 'preprod-payroll.trick.htb/index.php?page=php://filter/convert.base64-encode/resource=home' | grep -A 1 '<...
R4J's user avatar
  • 1
2 votes
1 answer
3k views

How to decode base64 for both Linux and macOS?

On Linux I can do: echo ${ANDROID_KEYSTORE} | base64 -di > android/keystores/staging.keystore But on macOS, the same commands give: base64: option requires an argument -- i Usage: base64 [-hvDd] [...
Dimitri Kopriwa's user avatar
0 votes
1 answer
396 views

How to force base64 encoding for s-nail attachments?

I have a job that picks up CSV files and sends them through an external mail service. Everything seems to be great, with one exception: I found that the windows style CRLF CSV files get mangled by ...
lopass's user avatar
  • 79
0 votes
0 answers
514 views

base64 decode as save as multiple files

I have a file(har file saved from web developer" that contains the base64 encoded value of multiple video*.ts files. I am interested to decode the base64 part and save as multiple ts files if the ...
maneesh murali's user avatar
0 votes
3 answers
293 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:...
Sergio Jimenez's user avatar
-1 votes
1 answer
12k 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 ...
CodeMed's user avatar
  • 5,259
3 votes
4 answers
2k 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 ...
Sergio Jimenez's user avatar
3 votes
1 answer
2k 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 ...
ghost21blade's user avatar
0 votes
0 answers
575 views

mutt & attachment encoding

So, I have a simple bash script that is intended to send a note to a user (say, the fictitious [email protected]), where said note contains a short snippet of text (contained in the file message....
Johnny Canuck's user avatar
-1 votes
1 answer
1k 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 ...
NotQuiteSo1337's user avatar
4 votes
2 answers
2k 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 ...
unnamedrider1337's user avatar
19 votes
3 answers
49k 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"}...
shwoseph's user avatar
  • 355
1 vote
1 answer
1k 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
-2 votes
1 answer
1k 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 ...
B K Karthik's user avatar
2 votes
2 answers
10k 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 ...
Washington Guedes's user avatar
1 vote
0 answers
2k 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 ...
Dino Tw's user avatar
  • 111
1 vote
1 answer
4k 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?
Christian's user avatar
0 votes
1 answer
17k 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 ...
leeand00's user avatar
  • 4,655
0 votes
3 answers
6k 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 ...
MatrixManAtYrService's user avatar
-6 votes
2 answers
7k 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?
GAK's user avatar
  • 1
1 vote
2 answers
275 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:...
fbid's user avatar
  • 121
1 vote
1 answer
712 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....
SummerRain's user avatar
-4 votes
1 answer
857 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?
Tim's user avatar
  • 103k
-1 votes
1 answer
394 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' > ...
user318418's user avatar
0 votes
3 answers
3k 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 ...
elysch's user avatar
  • 131
9 votes
1 answer
34k 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?
leeand00's user avatar
  • 4,655
9 votes
3 answers
40k 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 ...
Dave's user avatar
  • 2,588
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 ...
Vlastimil Burián's user avatar
-1 votes
1 answer
80 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.
jh436's user avatar
  • 7
4 votes
1 answer
3k 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 ...
Philip Kirkbride's user avatar
1 vote
2 answers
993 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......
Weej Jamal's 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 ...
robert's user avatar
  • 631
0 votes
2 answers
7k 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 ...
mat's user avatar
  • 298
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 ...
I wrestled a bear once.'s user avatar
2 votes
1 answer
108 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 ...
jacksonecac's user avatar
3 votes
1 answer
3k 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....
Christoph's user avatar
  • 193
1 vote
1 answer
570 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
αғsнιη's user avatar
  • 41.5k
14 votes
1 answer
22k 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 ...
starfry's user avatar
  • 7,510
5 votes
3 answers
4k 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 ...
user333869's user avatar
5 votes
3 answers
9k 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, ...
hourback's user avatar
  • 303
6 votes
1 answer
6k 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 ...
16851556's user avatar
  • 201
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) ...
netizen's user avatar
  • 111
2 votes
1 answer
10k 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 ...
Niklas Berglund's user avatar