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
1 answer

Generate password reset token through UUID

I am looking for mechanism to generate random unique alpha numeric key for resetting user password. I've goggled a lot in this direction, but looks like this thing is not obvious thing. I've tried something like that: new…
fashuser
  • 2,152
  • 3
  • 29
  • 51
4
votes
1 answer

decoding two different base64 strings returns two times the same string

base64 encoding / decoding uses deterministic algorithms. Because of that, a given input string will be always encoded to a known output string and vice versa. Using the browser to access a URL secured with basic authentication, the browser encodes…
mika
  • 2,495
  • 22
  • 30
4
votes
3 answers

base64 decoder in android in API level 7

How to decode a base64 encoded string to byte array on Android API level 7? Can it be done using any standard packages of Java? Should i copy the source code from google search results? Should i re-implement encoder and decoder according to…
Suresh
  • 9,495
  • 14
  • 49
  • 63
4
votes
0 answers

Save Task type to String giving Catastrophic failure

I am trying to save the Ink I write on Canvas in a class and reload it with these two methods found at this link. private async Task WriteInk() { using (var stream = new InMemoryRandomAccessStream()) { await…
yalematta
  • 1,389
  • 1
  • 21
  • 36
4
votes
1 answer

How to convert base64 string into an audio mp3 file?

I'm getting a base64 string from android side. I have to convert it into an audio file and have to save it into a folder. I thought I have to convert it first into byte array. Then after it, I have to convert it into a mp3 file. But don't know how.…
Akshay Vaghasiya
  • 1,597
  • 9
  • 36
  • 60
4
votes
2 answers

Nodejs writing zip file from base64

I am writing base64 encoded value to zip file. Following code i am using for writing: var base64Data = base64_encoded_value; base64Data += base64Data.replace('+', ' '); binaryData = new Buffer(base64Data,…
Manwal
  • 23,450
  • 12
  • 63
  • 93
4
votes
1 answer

Converting base64 string to X509 certifcate

I use PowerShell and thus far I have figured out how to take a X509 certificate flat file e.g. Cert.cer and concert it to a Base64 string for storage (e.g. in a database as a string etc.) and then convert it back again into a…
user2971567
  • 51
  • 1
  • 1
  • 4
4
votes
2 answers

Check if same image has already been uploaded by comparing BASE64?

My question is concerning an idea I had, where I could check if an image has already been uploaded by comparing their base64-encoded strings... Example use-case would be to find duplicates in your database... The operation would be pretty big i…
der-lukas
  • 936
  • 9
  • 13
4
votes
2 answers

Error C2026: string too big, trailing characters truntraced

i have a big problem and i dont know how to fix it... I want to decode a very long Base64 encoded string (980.000 Chars) but every time when i to debug it i get this error : Error C2026: string too big, trailing characters truntraced I tried this…
Dieter
  • 41
  • 1
  • 2
4
votes
2 answers

Encrypt & Decrypt Local Images in Windows Store App

I'm building a Windows Store App including a local folder of Images. I want to protect all the Images so they can't be accessed from: C:\Users[username]\AppData\Local\Packages\LocalState\Settings\settings.dat I know I should encrypt and decrypt…
yalematta
  • 1,389
  • 1
  • 21
  • 36
4
votes
1 answer

Apache Velocity macro to produce a Base64 encoded String

I have a server instance that uses velocity macros to generate testcases. There is a new requirement that the string returned by the macros should be in base64. I could easily do it in the server side after i get my data back from the macro, but it…
user3269589
  • 115
  • 1
  • 6
4
votes
2 answers

How to test if a base64 string is a valid image in PHP?

How to test if a base64 string is a valid image in PHP? I tried the following code: function convertAndSaveLogo($data, $id){ if(isset($data->base64_image) && $data->base64_image){ $imageData = base64_decode($data->base64_image); …
user3686362
4
votes
1 answer

How open new window with base64 PDF content?

I want open new window (with jQuery) and show PDF from base64 content. When I make normal link: shipping_label_content.'\" target=\"blank\">Show PDF It's all good. But I want automatic open new…
Kuba Żukowski
  • 653
  • 3
  • 11
  • 16
4
votes
2 answers

Strange behaviour of Convert.FromBase64String

Why does the following code var s = "2I=="; var b = Convert.FromBase64String(s); var new_s = Convert.ToBase64String(b); end up with new_s being 2A==? s was originally a longer string (96 chars) but I couldn't include it because it is a secret key.
eggbert
  • 3,105
  • 5
  • 30
  • 39
4
votes
1 answer

AugluarJS truncating trailing equal sign

AngularJS truncates the trailing equal signs when routing to them. I have a base64 string which need to be added as a query parameter to the url(route) ex: http://example.com/#!/updatepassword?code=NnuW3q49QW38Mf-Cg== this loads as: …
Chathuranga
  • 1,008
  • 1
  • 15
  • 26