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
2 answers

Join two Base64 strings and then decode them

I'm trying to figure out how to join two strings that are encoded Base64 and then decode and get the combined result. Example: string1 Hello --- string1 Base64 SGVsbG8= string2 World --- string2 Base64 V29ybGQ= If I join the base64 I get…
DonO
  • 1,030
  • 1
  • 13
  • 27
4
votes
1 answer

Accepting a byte array parameter in MVC API as Base64

I am currently building an ASP.NET MVC WebAPI service for which I'd like a small piece of binary data to be sent in the querystring. The method in this application is invoked through POST and the body contains the actual data. The querystring is…
4
votes
0 answers

Node.JS Convert Base64 String into Binary and write to MongoDB GridFS

I have a Base64 string that I am converting to binary like this: var b64string = req.body.image.substr(23);//The base64 has a imageURL var buf = new Buffer(b64string, 'base64'); I need to insert this into MongoDB GridFS. The problem I am having…
Rob
  • 11,185
  • 10
  • 36
  • 54
4
votes
1 answer

ANDROID : java.lang.NoSuchMethodError: org.apache.commons.codec.binary.Base64.encodeBase64String in android

want to generate signature for oauth login .for this i used HmacSHA1 and base64 algo.please have a look below code stuff.I already visit so many links related this but this gives solution for java plat form [J2EE] not for the Android .same code/…
Radhey
  • 2,139
  • 2
  • 24
  • 42
4
votes
1 answer

How to convert Base64 File to the actual file / original file in javascript and download it to client

Im sorry if my question is a bit confusing but I think can clarify this by my detailed explanation. Im very new to saving/uploading files. I have recently been able to upload image and save it to database as base64 (datatype = mediumblob) and…
TheOnlyIdiot
  • 1,182
  • 7
  • 17
  • 37
4
votes
1 answer

Is it possible to create a base64 string which has all frames of a multi page tiff file?

Converting a multi page tiff file to base64 string by using known conversion methods seems to contain just a single page of it. I'm getting the multi page tiff file from local disk: Image multiPageImage = Image.FromFile(fileName); Converting it to…
Orkun Bekar
  • 1,447
  • 1
  • 15
  • 36
4
votes
0 answers

decrypting in java returns wrong final block length (using android base64)

I'm making a small cryptor class for an app that a friend and i are making, all it has to do (currently) is decrypt and encrypt strings of data. but i keep getting the following exception when trying to decrypt:…
Louis
  • 61
  • 1
  • 2
4
votes
1 answer

C# - Converting multi page tiff file to base64 string and converting back results with single image

I'm opening a tiff file from local disk: Image multiPageImage = Image.FromFile(fileName); Then sending it to conversion method: base64string = ImageToBase64(multiPageImage, ImageFormat.Tiff); public static string ImageToBase64(Image image,…
Orkun Bekar
  • 1,447
  • 1
  • 15
  • 36
4
votes
1 answer

Converting Coldfusion encryption code to C#

I have a Coldfusion page that includes a section of code that encrypts a variable like this: We're moving the site to a .NET-based CMS, and I…
user3562286
  • 151
  • 2
  • 13
4
votes
2 answers

Convert base64 string to image and save

I am trying to convert base64 image data into image file and to save it. base64_image_str = request.POST.get('base64_image_str') # it is smthg like: "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDA......." with open("newimage.png", "wb")…
doniyor
  • 36,596
  • 57
  • 175
  • 260
4
votes
4 answers

Base64 image tag in safari did not showed up

I made a tsp which decode Image to base64 byte array String. It works in Chrome and Firefox. However in safari 8.0, it does not work. My jsp looks like below : String sFileInfo = ""; String name = request.getHeader("file-name"); String ext =…
Juneyoung Oh
  • 7,318
  • 16
  • 73
  • 121
4
votes
1 answer

What charset to use for json with base64 encoded binary data?

What is the most space efficient charset for JSON (UTF-8/16/32) for use of base64 encoded binary data? { data: "jA0EAwMCxamDRMfOGV5gyZPnyX1BB" }
Sebastian Barth
  • 4,079
  • 7
  • 40
  • 59
4
votes
2 answers

c# equivalent of base64 + UrlTokenEncode in clojure

I have a piece of code in C# that encodes string and returns URL safe string (that is decoded later on) string stringToEncrypt = "Winter is coming"; byte[] bytes = new byte[stringToEncrypt.Length *…
LocustHorde
  • 6,361
  • 16
  • 65
  • 94
4
votes
0 answers

Saving base64 string as PDF at client side Internet Explorer 10 and above

I am working on Saving base64 string as PDF at client side using 'data:application/pdf;base64,' with JavaScript. For Example Anchor tag for Download PDF on browser looks like this :
4
votes
1 answer

Cordova - Capture video and retrieve base64 data

I am using phonegap to record a video and I am wanting to save the base64 data-encoded string. So far I have tried this.. function captureSuccess(mediaFiles) { var i, path, len; path = mediaFiles[0]; win(path); } function win(file) { …
Pooshonk
  • 1,284
  • 2
  • 22
  • 49