Questions tagged [base64]

Base64 is a set of encoding schemes that represent binary data in an ASCII string format.

Base64 is a group of similar encoding schemes that represent binary data in an ASCII string format by translating it into a radix-64 representation. The Base64 term originates from a specific MIME content transfer encoding.

Base64 uses characters 0 to 9, A to Z and a to z to represent digits of 64-decimal numbers. The last two required digits differ between schemas. For instance, MIME (RFC 2045) uses + and / , XML names tokens use - and ., XML identifiers use _ and : and regular expressions use ! and -.

When encoding in Base64 text, 3 bytes are typically encoded into 4 characters. To encode arbitrary lengths, the padding character (=) is used. = at the end of encoded sequence means that only two bytes and == means that only one byte is encoded by the last 4 character group.

Characters outside the discussed alphabet are normally forbidden, except in MIME where they are discarded.

Base64 encoding schemes are commonly used when there is a need to encode binary data that need to be stored and transferred over media that are designed to deal with textual data. This is to ensure that the data remain intact without modification during transport. Base64 is commonly used in a number of applications including email via MIME, or to store binary data in textual formats such as XML or JSON.

Useful online tools

They work without enabled JavaScript too.

11149 questions
4
votes
3 answers

Is Base64 Encoded BSON smaller then BSON?

Is Base64 Encoded BSON smaller then BSON?
Faisal Abid
  • 8,900
  • 14
  • 59
  • 91
4
votes
1 answer

HMAC, RS and Base64 in Rust

I have a project in which RS and HMAC 256...512 are involved and base64. Is there any way to do encoding and decoding in such the algorithms in Rust already? If so, is it safe to them now, at this point of Rust development stage?
Incerteza
  • 32,326
  • 47
  • 154
  • 261
4
votes
0 answers

How to add base64 data to FormData so that it's uploaded as binary

I have a API source of image data in base64 format. I'm trying to upload it as normal binary upload. From MDN I can see that my problem is, given the Blob is available, reduced to making binary Blob from base64: var content =…
Tomáš Zato
  • 50,171
  • 52
  • 268
  • 778
4
votes
2 answers

Add image into div and convert base64 string into thumbnail using jQuery

The base64 string received into var img. Then I need to convert into an image and display it as a thumbnail. Here is my implementation: var img = "base64 string";
Here is the…
gihansalith
  • 1,770
  • 5
  • 17
  • 21
4
votes
3 answers

Is DatatypeConverter thread-safe?

In particular, is the method javax.xml.bind.DatatypeConverter.parseBase64Binary(String) thread-safe?
Alex
  • 327
  • 1
  • 3
  • 12
4
votes
1 answer

Error: The magic number in GZip header is not correct

I have two methods, one that I use to convert an image to a Base64 string so I can store it in an XML tag and another to convert the Base64 string back to an image. I'm able to convert the image to a string and store it in the XML, but when I try…
Icono123
  • 3,830
  • 3
  • 21
  • 20
4
votes
2 answers

How can I get base64 for a file?

I have tried using the below code which generates a base64 for the file and returns as string. I was able to get if the file size is small. StringBuffer output = new StringBuffer(); Process p; try { p =…
Kotesh Malempati
  • 103
  • 2
  • 2
  • 9
4
votes
1 answer

About VerifyPKCS1v15 (base64 and rsa check )

Given "notify" ,"publicKey" and "sign" , it doesnt pass the VerifyPKCS1v15 in go . That 's mycode , is there something wrong ? package main import ( …
frank.lin
  • 1,614
  • 17
  • 26
4
votes
1 answer

How to handle image being posted to PHP that wasn't base64 encoded?

I am trying to provide retroactive support for a desktop client that posts image data incorrectly to my PHP form. The problem is that the image data posted hasn't been base64 encoded and I can't change the distributed clients, so I'm wondering if I…
Dan
  • 367
  • 1
  • 5
  • 17
4
votes
2 answers

encode and decode bitmap to byte array without compress

i'm trying to encode and decode bitmap to byte array without using bitmap.compress but when i decode the array, BitmapFactory.decodeByteArray Always returns NULL The encode method is below: public byte[] ToArray(Bitmap b) { int bytes =…
L.Grillo
  • 960
  • 3
  • 12
  • 26
4
votes
1 answer

Rows to map to JSON using sqlx package

Trying to get the result into a JSON string, I have to use MapScan because i have no structs that represent the data so here is what i did import ( "fmt" "log" "encoding/json" _ "github.com/jmoiron/sqlx" _…
FPGA
  • 3,525
  • 10
  • 44
  • 73
4
votes
1 answer

socket.io binary buffer advantages?

Currently, im sending base64 strings over my socket.io 0.9 to send images around in my chat app. I upgraded to socket.io 1.0, which in the documentation says it supports Binary data, like Buffers. I have little knowledge over what Buffers are, but…
Laurens Kling
  • 2,221
  • 1
  • 21
  • 31
4
votes
2 answers

sharing cookies between rails 3 and rails 4.1

I am trying to have shared cookies between Rails 3 and Rails 4.1 apps. The problem is that the Rails 3 cookies are just base64 encoded, but the Rails 4.1 cookies are encrypted. Is there any way to make both Rails 3 and Rails 4.1 make to use…
4
votes
1 answer

Polarssl Base64.c error check

I used polarssl's base64.c file for decoding some data. int base64_decode( unsigned char *dst, size_t *dlen, const unsigned char *src, size_t slen ){ size_t i, n=0; uint32_t j, x; unsigned char *p; for( i = n = j = 0; i < slen;…
nerd
  • 115
  • 1
  • 7
4
votes
2 answers

Compress/decompress string on .NET server that was encoded with lz-string.js on client

I am using the LZString.compressToBase64 function of lz-string.js and need to decompress/compress the data on the server side. The obvious solution seems to be lz_string_csharp but I am concerned about this statement: If you use just the regular…
CodeToad
  • 4,656
  • 6
  • 41
  • 53