base64

Null reference exceptions during Base64 deserialization (C#)

I am using the following methods to serialize and deserialize .NET objects: public static string SerializeToBase64(object data) { var stream = new MemoryStream(); var formatter = new BinaryFormatter(); formatter.Serialize(stream, data); stream.Position = 0; return Convert.ToBase64String(stream.ToArray()); } public s...

Loading image data from xml file.

Hi All. I have the following code that loads data from an xml file. I've done this quite a while back but don't have that code anymore, and this isn't working. (I can successfully write image data to file. But loading it and converting to image object isn't working): p.Image = Base64ToImage(controlTag.Attributes("Content").First().Value...

Django urlsafe base64 decoding with decryption

I'm writing my own captcha system for user registration. So I need to create a suitable URL for receiving generated captcha pictures. Generation looks like this: _cipher = cipher.new(settings.CAPTCHA_SECRET_KEY, cipher.MODE_ECB) _encrypt_block = lambda block: _cipher.encrypt(block + ' ' * (_cipher.block_size - len(block) % _cipher.block...

JQUERY - Retrieve binary (base64) encoded picture from XML and display in DOM

I retrieve this XML file with $.ajax({type: "GET", url: "data.xml",dataType: "xml",success: parse }); <Data> <user> <U_ID>4787<U_ID> <U_NAME>Mickey Mouse</N_NAME> <U_TYPE>1</U_TYPE> <U_PIC>iVBORw0KGgoAAAANSUhEUgAAAHgAAAB0CAYAAABOpv</U_PIC> </user> </Data> Where <U_PIC> contains a base64 encoded pictur...

How do I encode/decode short strings as Base64 using GWT?

I need to encode a short String as base 64 in GWT and decode the base 64 string on the server. Anyone have utility class or library for this? ...

Show a GUID in 36 letters format

Hi. GUID is big random number show in a HEX basis. I want to show this number in a shorter format, lets say that based on the all letters and numbers. That is a 36 basis. Lets say that: 2f1e4fc0-81fd-11da-9156-00036a0f876a will become as 3jEl9x6eZi. Is there any 'ready' algorithm for this in .Net? it need to be bidirectional. Edit:...

Do I need to encode encrypted bytes before sending?

Do I need to encode my encrypted bytes when sending it through java data streams for instant messaging? Sending encrypted bytes don't look very safe to me. If so, should I use Hex or Base64 encoding? Thanks ...

Java equivalent of Convert.FromBase64String Method

Hi! Is there some Java equivalent of Convert.FromBase64String which Converts the specified string, which encodes binary data as base-64 digits, to an equivalent 8-bit unsigned integer array. I have tried: com.lutris.util.Convert. but it gives me signed values encode to string then convert to unsigned bytes, but then it gives...

Delivering Silverlight in HTML object or embed tag base64 encoded data

It is possible to base64 encode an image and deliver it as part of the html content using the <img src="data:image/gif;base64,UEsDBBQAAAgIALp9...MTs9Snj3=="> I notice that Silverlight's object tag is supposed to be something like: <object type="application/x-silverlight" data="data:application/x-silverlight;base64," width=...

How to convert string to base64 byte array, would this be valid?

Hi, I'm trying to write a function that converts a string to a base64 byte array. I've tried with this approach: public byte[] stringToBase64ByteArray(String input) { byte[] ret = System.Text.Encoding.Unicode.GetBytes(input); string s = Convert.ToBase64String(input); ret = System.Text.Encodin...

Zend framework - not entering values in database - garbage going in

Hi guys I'm in an emergency here. My code was working FINE for a while when ALL of a sudden somethings gone wrong and I havent a clue what! I store an object in my database by serializing it and then running a base64_encode on it. The result is an encoded serialised string which when I wish to retrieve I just decode and unserialise it. ...

iPhone - encode Array of Data from CoreData Entity and store in Base64 String

I have a data model with three entities (Purchase, Items, Image) the purchase is the main with the other two as related attributes. I need to be able to send the data to a web server, and I must encode in base64, I have a couple of classes that take care of the encoding and decoding that i downloaded from the net, they are categories fo...

ASCII Text String Shortening

I am not really interested in security or anything of that nature, but I need some function(s) that allow me to "compress"/"decompress" a string. I have tried Base64, but that has a big issue with the size of the string, it makes it longer. I also know about this Huffman stuff, but that doesn't work either because it too makes it longer ...

When using a unique alphanumeric string for a short url, is it better to store the created string in the database or encode/decode on the fly?

I want to create shortened links for specific pieces of content on my site. To view these pages now, I pull the relevant content via the content ID passed via GET (ie, mysite.com/content/?id=332). To obfuscate the ID, I want to use base64 to encode and decode it into a short alphanumeric string (like 34sa6), which I already know how to d...

Decoding base64 php file

I currently have an encoded footer file for a wordpress file I want to decode, because the theme author has put in some 'interesting' links. Don't get me wrong, I'm very happy to link back to the author, but gambling sites aren't really what I want! The file is this- <?php $o="QAAAOzh3b3cnbmlka3JjYicvUwAAQkpXS0ZTQldGU08nKScgKAEAZWhzc2...

How to display images in Word generated from HTML?

I'm currently creating a Word document by generating HTML and changing the header information to display as a .doc file. It's a poor man's method, but it works just fine (until now). I was just asked to include an image in the file. My best idea was to base64 embed the image. This works fine in a browser, however Word just gives me a...

How to convert object which receives image in bytes into actual image?

I am developing smart device application in C#. In that I am calling the web services. The web service method return google map. The return type of the method is object. The object contains the image in byte format. The object conatins the image in base64binary format. I need to display the actual image in my application. What type of ca...

How to compress data on asp.net and uncompress in javascript

Hi this is my first Question :) I need a lib or way to compress a data in asp.net (vb) with the algorit deflate but the result inflate in javascript. I'm use a lib in javascript: deflate.js hxxp://www.codeproject.com/KB/scripting/Javascript_binaryenc.aspx?msg=2904739 First i'm deflate and convert to base64 the result but the result is...

Need to Base64 Decode This String

I tried decoding this base64 string so many times but every time i get some parts that decode fine but other parts are all gibberish, can anyone help me ? PD94bWwgdmVyc2lvbj0iMS4wIj8_DQo8cm9vdD4NCgk8YTQ2Nzg2NT4NCgkJPHQ_DQoJCQk2DQoJCTwvdD4NCgkJPHU_DQoJCQlodHRwOi8vbWlsbGVkcml2ZS5jb20vdmlkZW9zLzQxODQxL1NodXR0ZXJfSXNsYW5kXzJfMi5odG1sDQoJCT...

URL shortener: best encoding method?

I'm creating a link shortening service and I'm using base64 encoding/decoding of an incremented ID field to create my urls. A url with the ID "6" would be: http://mysite.com/Ng== I need to also allow users to create a custom url name, like http://mysite.com/music Here's my (possibly faulty) approach so far. Help in fixing it would be a...