FAQ Database Discussion Community


How to convert a Base64 string to Bitmap on Android?

android,json,base64,decode
I'm having this problem for converting several Base64 string to Bitmap images, in my android application. Now I've looked for solutions for quite a while, but nothing seems to solve my problem. My application gets JSON data from a server, containing several images in base64. the json code received from...

Base64 encode single row in an array

php,android,base64,gson
I'm building an Android app, that is supposed to be able to take a photo, and then store it in a database. I got that part down. However when I try to load it into my app again, that's when it gets tricky. I have the image stored as a...

convert data URI from png to webp

node.js,base64,webp
In node.js I need a way to convert a string from base64 png to base64 webp. I say string because of the nature of my application. Were I to save these particular images then convert them (there are some npm modules that convert image 'files') my server would be filled...

Android Base64 Encoding and Apache codec decoding

java,android,encryption,base64,rsa
We are using following method for encoding a string using ANDROID Base64.NO_CLOSE public static String encrypt(String inputString, byte[] keyBytes) { Calendar cal = Calendar.getInstance(); int mDay = cal.get(Calendar.DAY_OF_MONTH); // System.out.println("Day of month :::" + mDay); String encryptedString = ""; Key publicKey = null; try { Random generator = new Random(mDay);...

Base64 encoded string differs in perl and Java

java,perl,base64
when i encode a pdf file into base64 binary(using commons lib) in java , I got string(sample) like "SGVsbG8gV_29y-bGQ=" But if i encode the same file using perl , I got like "SGVsbG8gV/29y+bGQ=" Difference in string: / instead of _ , + instead of - Why i am getting like...

How can I convert a Base64 string to a float array or int array?

c#,linq,base64
I have some code that converts a float[] to a Base64 string: float[] f_elements = <from elsewhere in my code>; byte[] f_vfeat = f_elements.SelectMany(value => BitConverter.GetBytes(value)).ToArray(); string f_sig = Convert.ToBase64String(f_vfeat); I also have - basically - the same code that converts an int[] to a Base64 string: int[] i_elements =...

My base64 encoded byte[] stream has extra characters after sent through a http response

java,pdf,base64
I encode a pdf into a base64 byte[] stream and I want to send it as a http response to the browser. The problem is that the browser fails to load pdf. I compared the base 64 string which I printed into the IDE console and the one from the...

convert base64 Image to Sql Blob in JAVA

java,base64,bytearray,blob
I'm trying to convert Base64 to Blob in JAVA, I have developed this code so far and it's working but it's not a blob: public static BufferedImage decodeToImage(String imageString) { BufferedImage image = null; byte[] imageByte; try { BASE64Decoder decoder = new BASE64Decoder(); imageByte = decoder.decodeBuffer(imageString); ByteArrayInputStream bis = new...

Pass base 64 string using ajax script

php,ajax,post,base64,content-type
i have use the following script to pass the string url to another php page. function saveIt(){ var xmlhttp = new XMLHttpRequest(); xmlhttp.onreadystatechange = function() { if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { alert("Save successfully!"); } } var value1 = document.getElementById("url").value ; var value2 = document.getElementById("time").value; var value3...

Encoding and decoding strings with the use of java.util.Base64

java,encoding,base64,java-8,decoding
I try to find a way to encode and decode strings with the use of java.util.Base64.Encoder and Decoder classes. Unfortunately, it is impossible to call encode and decode methods statically, so I've created references to Encoder and Decoder classes. But in order to create an instance object for each of...

why can't I import seperately from the method decleration?(java)

java,eclipse,import,base64,decode
I wrote a simple program to decode a base64 encoded String I have. I searched using eclipse for a method to do that and found out that the method javax.xml.bind.DatatypeConverter.parseBase64Binary(String s) does esactly that. I found out that when I'm using the full location of the method, the program is...

mysql select where base64 not before

mysql,base64
How do I Select a query from mysql and search WHERE it from a column that is based64 encoded? any kind of help is great appreciated: SELECT * FROM `customer` WHERE base64_decode(name) LIKE '%bobby%' ...

Encrypt & Decrypt Local Images in Windows Store App

c#,encryption,windows-store-apps,base64,windows-8.1
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 the Images using the DataProtectionProvider class, but the documentation only shows how to encrypt/decrypt strings... How should...

How to avoid storing password in Python code

python,passwords,base64
I need to use a password to sign in a service I need to do some stuff in Python, but I don't want to store the password in the code. I did some research and found the base64 encode. This seems good, but it requires the password to be stored...

Should I BIO_flush() after BIO_read()-ing?

openssl,base64,decode,flush,decoder
So I implement a base64 decoder and while encoding (BIO_write() on BIO_f_base64) you should BIO_flush() as they say in documentation. However, they don't mention anything regarding BIO_read() (decoding). Should I flush after BIO_read() and if not what are the consequences if I do?

Base64 encode/decode issue

openssl,hex,base64,ocaml
I have two functions to convert to and from base64 using openssl: (* base64 encode *) let encode_base64 msg = let open_ssl_arg = "echo -n '" ^ msg ^ "' | openssl enc -base64" in let ic = Unix.open_process_in open_ssl_arg in let rec output s = try let new_line =...

Java - The method encodeBase64

java,base64
I have a String String x = "Sample text"; and I want to print the base64 encryption of it. As numerous examples mention, I use: byte[] encodedBytes = Base64.encodeBase64(x.getBytes()); System.out.println("encodedBytes " + new String(encodedBytes)); But this gives me The method encodeBase64(byte[]) is undefined for the type Base64... Why is that?...

HTML5 Canvas Base64 Error [closed]

javascript,html,canvas,base64
Any idea why this code is not working? :\ Demo -> https://jsfiddle.net/vgmFN/89/ <script> var imgObj1 = new Image(); var img = new Image();var a1=0; var can = document.getElementById('canvas1'); var ctx = can.getContext('2d'); imgObj1.onload = function() { ctx.drawImage(imgObj1,1,1);a1 = 1; } imgObj1.src = 'favicon.ico'; if (a1 == 1) { console.log(can.toDataURL()) img.src...

Read stream from XmlReader, base64 decode it and write result to file

c#,xml,base64,xmlreader
Basically, I want to extract the stream from the XmlReader and directly base64 decode it to a file. The structure of the XML file can be seen here. To get the value I have to use ReadInnerXml(). Is it possible to use ReadValueChunk instead? Here is my current code: using...

When sending an email with meteorjs, the base64 inline image is not displayed correctly

html,email,templates,meteor,base64
Current situation: (Client side) The template: <template name="feedback"> <h1>The Image</h1> <img src="{{image}}" alt=""/> </template> (Client side) Calling the mail function: var dataContext={ image: canvas.toDataURL('image/png') }; var html=Blaze.toHTMLWithData(Template.feedback, dataContext); Meteor.call('feedback', html); (Server side): Email.send({ to: 'xxx', from: 'xxx', subject: 'xxx', html: html }); Expected result: A nice email with an embedded...

Python requests base64 image

python,base64,python-requests
I am using requests to get the image from remote URL. Since the images will always be 16x16, I want to convert them to base64, so that I can embed them later to use in HTML img tag. import requests import base64 response = requests.get(url).content print(response) b = base64.b64encode(response) src...

Dont resolve promise until after images load

javascript,jquery,image,base64
The below is supposed: loop through a group of img tags grab each tag's src url convert it to a base64 encoded string using a HTML 5 canvas once all images have been converted, the promise should be resolved and the callback called My problem: I need to wait for...

searching base64 decoded binary data for text in Python

python,base64
I have some data in a database that is base64 encoded I am decoding it easily enough with b64 = base64.b64decode(row[2]) however I now need to search the decoded data for various text strings and get the offsets of said strings. The decoded data is binary i.e. it contains lots...

Base64 image conversion in android resulting in corrupted image

android,json,base64
I need to upload JSON to server so I tried to encode it using base64 and then sending it through JSON but while decoding the image at the server end, the image appears corrupted. I even tried online base64 to image converters, result being the same. Here is my Activity...

Base64 decode for image/jpeg;base64 in android

android,base64,bitmapfactory
I am trying to decode base64 encoded string into bitmap in android. The encoded string will start with "image/jpeg;base64," I use the following method: public static Bitmap decodeBase64(String input) { byte[] decodedByte = Base64.decode(input, Base64.DEFAULT); // also tried using Base64.URL_SAFE , Base64.NO_PADDING return BitmapFactory.decodeByteArray(decodedByte, 0, decodedByte.length); } Assume that I...

How in Angular JS obtain and send a picture?

javascript,angularjs,image,base64
I have URL that I am trying to get a picture from. I'm using the $http.get() method, but get a binary response. How can I get something back that I can insert into the page? $http.get('https://exampleurl/images/' + $scope.element[i].id) .success(function (response) { // I have response such as: ""����JFIF``��;CREATOR gd-jpeg v1.0...

Regeneration of SecretKey results in different key in java

java,encryption,base64,secret-key
I am trying to create an Encryption Program. However, The problem is when I am trying to Regenerate the SecretKey, I get different key which is not the same as the encryption key. Here is my code snippet which I am using for testing purpose.` import com.sun.org.apache.xerces.internal.impl.dv.util.Base64; import java.util.*; import...

Who is adding “\n” in Base64 encoded image when I write it in a file? Java

java,android,image,encoding,base64
WHAT I'M DOING I need to send via HTTPS request a JsonArray with some data and images in Base64 encoded strings. This works well if data is stored in memory. Now, I need to avoid load all data in memory and I'm creating a temporally file in android device with...

Base64 video encoding - good\bad idea?

javascript,html,cordova,video,base64
I'm working on a mobile front-end project using cordova, and the backend developer i'm working with insists that the media files (images/videos) should be transferred as base64 encoded in json files. Now, with images it's so far working. Although it freezes the UI for a few seconds, it can be...

Is Base64 an encryption or encoding algorithm?

encryption,encoding,base64,public-key-encryption
I have to use an encryption algorithm using Base64 but when I researched online I find forums state it is an encoding algorithm. This has me confused. :( Is Base64 an encryption or encoding algorithm? How do we differentiate between the two except for the fact that one is publicly...

How can i save base64 to image file on cordova / ionic or upload to server?

javascript,image,cordova,base64,ionic
I write cordova application using ionic framework. My goal is to receive image from the gallery and send it to the server as base64 string. But when I do so server says that request is too large and denies it. I’m kinda stuck at this moment. What is correct way...

Most efficient way to transmit file over TCP

c#,serialization,tcp,stream,base64
I'm currently transmitting files by Gzipping them and then converting to a base64 string, it's working well enough however I'd like to make it more efficient if possible as I'm sure this is not the best way to do it due to the 33% size increase due to Base64. The...

How to use decode jquery script

jquery,base64,decode
I need base64 decode script. I have for example: var windowWidth = $( window ).width(); var windowHeight = $( window ).height(); var documentWidth = $( document ).width(); var documentHeight = $( document ).height(); I use this online plugin: Base64 Decode Encode Plugin and result from this plugin is:...

Encode array to base64 in go

xml,go,base64,gorp
Here is my complete code for a function I develop: package main import ( "database/sql" "log" "encoding/xml" "github.com/gin-gonic/gin" //golang frameworks _ "github.com/go-sql-driver/mysql" "gopkg.in/gorp.v1" //work with database(mysql, etc.) ) type Genre struct { Title string `xml:"genre"` } type GenreArray struct { Auth_state int `xml:"auth_state"` Count int64 `xml:"count"` Item genreAPI `xml:"item"` }...

Can CDNs handle base64 encoded data?

image-processing,upload,xmlhttprequest,base64,cdn
I'm trying to make an app where I take pictures from users add them to a canvas, draw stuff in them, then convert them to a base64 string and upload them. For this purpose I'm considering the possibility to use a cdn but can't find information on what I can...

Can I store image on Firebase as file, instead of a data:url?

image,file,base64,firebase,data-url
I want to store image on firebase and want to use it somewhere. I went through this SO post and tried this demo. It stores images as data:url format. But I want to upload and store images as physical file so I can use it further, something like this url...

Is there anymore documentation on the IDML HTMLItem specification and HTMLItem poster property?

base64,indesign,adobe-indesign,idml
I'm working with coding with the IDML documents and I'm looking for more information on the IDML HTMLItem. I have both the version 7 and version 8 of the IDML specification and have not found anymore information then a small mention in the "new elements" of version 8, The HtmlItem...

Base64 encoding/decoding in Coffeescript

coffeescript,base64
I am trying to encode/decode a string with base64. Does coffeescript have any inbuilt support for this ? I found this library: https://github.com/carlcalderon/Base64.coffee . Is there a better way to do it in Coffeescript ?...

base64_decode return null when trying to upload image

java,php,base64,decode
I am trying to upload an image to server but base64_decode always returns null i read a lot of different cases from SO but nothing works. here is my java code before i make my http request: ByteArrayOutputStream stream = new ByteArrayOutputStream(); // Must compress the Image to reduce image...

Base64_to_stream Turbo power Lockbox 3.6.2 Delphi Xe7 | E2010 Incompatible types: 'System.TArray' and 'string'

delphi,encryption,base64,rijndael,lockbox-3
i am trying to make program to encrypt on delphi XE7 and Decrypt on PHP side i use Lock box 3.6.2 using AES 256 Encryption CBC mode . the Delphi XE7 Code : Main.pas unit Main; interface uses System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants, FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, TPLB3.CryptographicLibrary, TPLB3.BaseNonVisualComponent,...

saving base64 decoded string into a zip file

java,string,zip,base64,decode
I am trying to save a base64 decoded string into a zip file using the mentioned code: Writer out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream("/home/wemohamm/Desktop/test.zip"))); out.write(decodedString); out.close(); Here decodedString contains base64 decoded string and I can output it. I am running the code in rhel6 with Java 1.6. When I try...

Why SHA256 hashes finish with “ = ”?

base64,behavior,sha256
I've made a Webservice which returns a security Token after a successful authentification. However when debugging I noticed that every hash the webservice returned finishes with "=" such as: "tINH0JxmryvB6pRkEii1iBYP7FRedDqIEs0Ppbw83oc=" "INv7q72C1HvIixY1qmt5tNASFBEc0PnXRSb780Y5aeI=" "QkM8Kog8TtCczysDmKu6ZOjwwYlcR2biiUzxkb3uBio=" "6eNuCU6RBkwKMmVV6Mhm0Q0ehJ8Qo5SqcGm3LIl62uQ=" "dAPKN8aHl5tgKpmx9vNoYvXfAdF+76G4S+L+ep+TzU=" "O5qQNLEjmmgCIB0TOsNOPCHiquq8ALbHHLcWvWhMuI=" "N9ERYp+i7yhEblAjaKaS3qf9uvMja0odC7ERYllHCI="...

Why libxml won't allow me to create a node with base64 text content?

c,xml,base64,libxml2
I am using libxml2 to create an xml document which contains base64 encoded text in C. However when I try to add a element which contains base64 encoded and then print the xml the element is empty. I also added printf to check whether the encoding is done and it...

It is possible to know if a string is encoded in base64?

ios,swift,base64,qr-code
Simple as that. I'm making an app where the user has to scan a QR code (which basically is a base64 encoded string), is there any way to verify that the string is encoded in base64 before decode and follow the flow of the application? My code would be responsible...

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

android,eclipse,oauth,base64,signature
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/ method is working fine and generate signature...

Which encoding should I use to save AES encrypted password in property file? [closed]

java,encryption,encoding,base64,decoding
My task is save encrypted password in property file. I have this code and it is working properly, but I am looking for some alternative in Java space. Could somebody give me other properly working encoding than base64? byte[] key = { '^', '(', 'S', '2', 'k', '*', '*','@', 'z',...

trim base64 string by ltrim() missing character in PHP

php,base64,trim
here is a base64 code begin with: data:image/png;base64. I use ltrim() like this: $base64_data='data:image/png;base64,iVboR....'; $base64_data = ltrim($base64_data,'data:image/png;base64,'); but the result is wrong whitout character "i". is "VboR...." why?...

AugluarJS truncating trailing equal sign

angularjs,url,parameters,base64
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: http://example.com/#!/updatepassword?code=NnuW3q49QW38Mf-Cg Is there a workaround for this? ...

How to convert a file to Base64?

android,base64
Here the report contain the path(pathname in sdcard in string format) File dir = Environment.getExternalStorageDirectory(); File yourFile = new File(dir, report); String encodeFileToBase64Binary = encodeFileToBase64Binary(yourFile); private static String encodeFileToBase64Binary(File fileName) throws IOException { byte[] bytes = loadFile(fileName); byte[] encoded = Base64.encodeBase64(bytes); String encodedString = new String(encoded); return encodedString; } in...

Do you remove the data:image/jpeg;base64, before decoding Base64 string using C#?

c#,asp.net,image,base64,file-conversion
I'm trying to convert a Base64 encoded string that was generated from a re-sized image from the canvas element and I'm getting the following error when converting using the Convert.FromBase64() The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters,...

Value after Base64 encoding/decoding are not the same

android,encryption,base64
I need to encode/decode my data before storing in database but i have strange problem, After decoding, the value are not the same as first for example look at this code why seedBytes1 and seedBytes2 are not the same? (I tried encodedSeedBytes.getBytes("US-ASCII") instead of encodedSeedBytes but no success) seedBytes =...

Display image from DB on zk zul listbox

base64,zk
I have an entity that includes image that type byte[]. So the return type is byte[].I have to get image and show on a listbox.My codes are below. public class KitapListesiControl extends SelectorComposer<Component> { private static final long serialVersionUID = 1L; private List<Kitaplar> kitapList = new ArrayList<Kitaplar>(); private ListModel<Kitaplar> kitapListModel;...

change _id string to base64 encoded string in mongodb via mongoose

node.js,mongodb,mongoose,base64
By default mongodb generates some random string like 5548087025c7f79259525eff its type is ObjectId. Instead of that random string i want to use base64 encoded string so that it will always start from alphabet because I want CRUD on embeded documents which is not possible if id starts from integer according...

Go Hmac SHA1 generates hash different from Hmac SHA1 in Java

java,go,base64,hmacsha1
I'm just starting to learn Go and I'm trying to rewrite my existing small application from Java to Go. I need to create Base64 hash of input string with key using Hmac SHA1 algorithm. My Java code: private String getSignedBody(String input, String key) { String result = ""; try {...

Angular : get Dimension from Base64 Image

angularjs,image,size,base64,ionic
I'm developping an mobile application with cordova and ionic and I would like to get the size of the image contained in a string without showing it (no img element in html). I have 2 problem, I've found a solution but with onload event and I don't use jQuery. Is...

Own implement encoding and decoding base64 files in Python

python,encoding,utf-8,base64,decoding
I have a problem with my own implementation of base64 encoding. I have achieved to get the code below. It only works for text files with the English Letters, I suppose. For instance pdf file is encoded and decoded, it differs single characters. def base64Encode(data): alphabet = ["A", "B", "C",...

Rails Base64 decoding

ruby-on-rails,openssl,base64
I have to implement a client and server for end-to-end encryption. So if I am correctly informed, I need to encode and decode my keys with Base64. ArgumentError (string contains null byte): app/controllers/users_controller.rb:46:in `register' This is what I get just after the request reached my Server. And that is the...

particular single product's price, title and other detail fetch using flipkart api

php,mysql,json,api,base64
I am using clusterdev.flipkart-api and from this api i got flipkart directory name and link then click on it i am getting directory's available products. But i need to fetch particular product's price, title, inStock details from this api. i had try to make some changes but i don't have...

Remove the new line “\n” from base64 encoded strings in Python3?

python,python-3.x,base64
I'm trying to make a HTTPS connection in Python3 and when I try to encode my username and password the base64 encodebytes method returns the encoded value with a new line character at the end "\n" and because of this I'm getting an error when I try to connect. Is...

Upload base64 Image with Paperclip - Rails 4

ruby-on-rails,ruby-on-rails-4,base64,paperclip
I am relatively new to Rails and would appreciate any help. My website accepts a signature image in base64 format and I am trying to use a Paperclip adaptor to decode the image and save it to my form model as the :signature attribute. I am using the advice given...

How to serve an image in Django using jquery

javascript,jquery,html,django,base64
I am trying to update a div element in my html page with a png image which gets returned from the Django server. In my client-side script where I send an ajax POST request on a button click, I have - $('#mybtn').click(function (event) { event.preventDefault(); $.ajax({ url: "/analysis", type: "POST",...

How to resize an image an cut the excess area of it in Python?

python,python-2.7,base64,decode,encode
I have a string which contains the base64 code of an image. I need to resize this image to 591x608px, but I don't want it to be deformed if it has a different scale. I don't know if this is the best way (please, correct me if there is a...

Rendering a Base64 PNG with Express

javascript,node.js,image,express,base64
My Node.js server has something that looks like the following: app.get("/api/id/:w", function(req, res) { var data = getIcon(req.params.w); }); Here, data is a string containing a Base64 representation of a PNG image. Is there any way I can send this to a client accessing the route encoded and displayed as...

Base64 image preg_replace in php

regex,image,base64,preg-replace
Hi i'm facing problem with replacing base64 embedded image with simple pound chracter "#" and the string i have to replace is...

Restlet how to decode secret in HTTP basic authentication

java,rest,base64,jax-rs,restlet
I have the following class handling one of my routes: public class HotelsSrv extends ServerResource implements HotelsListResource { private String hotelId; @Override protected void doInit() throws ResourceException { super.doInit(); String str; String secret = getRequest().getChallengeResponse().getSecret().toString(); byte[] bytes = new BASE64Decoder().decodeBuffer(secret) str = new String(bytes); System.out.println("user: "+getRequest().getChallengeResponse().getIdentifier()); System.out.println("password: "+str); } I...

Cant open a base 64 encoded pdf

pdf,encoding,base64
I'm trying to open a base64 encoded pdf sent back to me by a web service. This is the response header Access-Control-Allow-Credentials: true Access-Control-Allow-Methods: GET, PUT, POST, PATCH, DELETE, OPTIONS, HEAD Access-Control-Allow-Origin: * Connection: keep-alive Content-Type: application/json;charset=UTF-8 Server: Apache-Coyote/1.1 Transfer-Encoding: chunked RESPONSE BODY { "success": true, "message": "", "value": "SlZCRVJpMHhMamNLSmJXMX........

Cant use base64 image inside img tag?

javascript,html,angularjs,image,base64
Node js unirest.get("MYROUTE") .header("X-Mashape-Key", "MYKEY") .end(function (result) { console.log(result.status, result.headers, result.body); if(result.status==200) { var buffer = (new Buffer(result.body.toString())); res.end(buffer.toString("base64")); // output content as response body //res.end('data:image/jpg;base64,'+result.body) } }); Returns (I erased a lot, but its base64)...

Encode base64 and Decode base64 using delphi 2007

delphi,encoding,base64,decoding,delphi-2007
I have to encode an array of bytes to a base64 string (and decode this string) on an old Delphi 2007. How could I do? Further Informations: I've tried synapse (As suggested here Binary to Base64 (Delphi))....

Base64 encoding ommits final 2 bytes

android,base64
This code is going to encode a bitmap to Base64. For debugging purposes I've written also few lines to put all the data into ordinary files. Problem is that files are different: File saved directly from bitmap: DB 5A C4 80 00 00 file saved from decoded b64 data: DB...

Express JS 4.0, serve binary data, request Accept header changes output

javascript,node.js,express,base64,utf-16
Thanks in advance. Short: Express JS 4.0 alters the output data, due to the Accept headers in the request. Is there a way for me to override this behaviour, and just write the same data regardless of the request headers. When Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8 is present output is changed. Is there...

RegExp to find specific string with random characters in between

php,regex,base64,hacking
I'm not even hopeful that this is possible. I'm looking for the string "base64_decode" in PHP files (yes this is to clean up a site that has been hacked). The problem is that this hacker has "hidden" the string like so: 'ba'.'se'.(32*2).'_d'.'eco'.'de' or 'b'.'as'.'e6'.'4_d'.'ec'.'ode'; And a few other ways. Therefore...

convert base64 string to byte array like C# method Convert.FromBase64String

c#,swift,base64
I have this example method in C#: public static byte[] FromBase64Url(string data) { data = data.Replace('-', '+').Replace('_', '/'); return Convert.FromBase64String(data); } and I would like to implement it in Swift. I tried this: class func fromBase64(baseString: String) -> [UInt8] { let data = baseString.replace("-", withString: "+").replace("_", withString: "/") var buff...

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

php,base64,string-comparison
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 guess - first converting the image to base64and then...

Why do Base64.decode produce same byte array for different strings?

java,encoding,base64,decoding
I'm using URL safe Base64 encoding to encode my randomly generated byte arrays. But I have a problem on decoding. When I decode two different strings (all but the last chars are identical), it produces the same byte array. For example, for both "dGVzdCBzdHJpbmr" and "dGVzdCBzdHJpbmq" strings the result is...

Base64-decode a string using NetEncoding in Delphi XE7?

delphi,base64,decode,delphi-xe7,utf8-decode
In Delphi XE7 Update 1, when trying to execute this code in a VCL program: uses System.NetEncoding; ... tempstring := TNetEncoding.Base64.Decode(tempstring); I get this error message: So how can I base64-decode a string using NetEncoding?...

Base64 encoded excel file not decoding in email attachments

php,excel,email,base64
I am creating an excel file and attaching it in an email. The email sends with the excel file attached, but the contents are all mucked up (N¬ŠÆ›j×!­êh®×è®Ø^¥êè‰ÚÓzÛMy¶9×Í´×). $sFileName = "BatchReport".date("Y-m-d"); $eContent = chunk_split(base64_encode(file_get_contents(WP_PLUGIN_DIR."/cs-cart/includes/excel/".$sFileName.".xls"))); $sUniqueID = md5(uniqid(time())); $sHeaders = "From: " . (($sFrom) ? $sFrom : "Cervid Solutions <[email protected]" ....

Ajax not post base64 data of large image

javascript,php,jquery,ajax,base64
I am passing Image base64 data through ajax to my php function, but for large size image Ajax does not post the data. But the same code works perfectly for small images....

Javascript: Loading many images into DOM from a custom API without base64-dataURLs

javascript,canvas,base64
Contexxt: I'm currently working on a web-app built using Angular with an API written in Silex. I've got the following situation: An Angular-page with up to hundreds of clickable thumbnails. On click, a lightbox-plugin opens the full-size image An API requiring a custom token-header to load each picture Very well,...

PHP base64 encoding drops incorrect answer

php,websocket,base64
I'm currently working on a website, which must implement a web-socket server. I am using PHP to make the server. I extracted a Sec-websocket-key from the clients response, then I hashed it using the PHP sha1() command. The problem is that when I want to base64_encode it then it gives...

NodeJS Buffer Base64 File Limits

javascript,node.js,base64,restify
Tried to upload an image using Base64 but if the string is long the bottom of the stored image is blank white. upload.js var uuid = require('node-uuid'); var fs = require('fs'); exports.uploadImage = function(base64Str, callback) { var filename = uuid.v1()+'.png'; var bitmap = new Buffer(base64Str, 'base64'); fs.writeFileSync(filename, bitmap); callback(filename); };...

Base64 string format in python

python,base64,string-formatting
I'm having an issue figuring out how to properly input base64 data into a string format in python 2.7. Here's the relevant code snippet: fileExec = open(fileLocation, 'w+') fileExec.write(base64.b64decode('%s')) %(encodedFile) # encodedFile is base64 data of a file grabbed earlier in the script. fileExec.close() os.startfile(fileLocation) As silly as it may...

Decode a signed cookie in rails?

ruby-on-rails,ruby,base64,decoding
So I have a signed cookie that has the following value IjVvVGdIOW1pUU44Qkk5NFZZUl9Udnci--a3c3b748fd207ba1c537b590dd458b4855677146 I need to decode it and get the following value 5oTgH9miQN8BI94VYR_Tvw I tried something like Base64.decode64(cookie_value.split('--').first) but it gives me the wrong value, it adds these damn slashes in the string so I end up with "\"5oTgH9miQN8BI94VYR_Tvw\"" ...

How to use “iHarder” base 64 encoder on android [closed]

java,android,base64
This is the Base64 class : http://iharder.sourceforge.net/current/java/base64/ the problem is, i have two Editext and one Button in my activity.so i need to use this for encode the string from Edittext1 with the one Button and then it show us the result(encoded result) on EditText2. how we can do this...

PHP base64_encode failed and script terminated with blank page?

php,base64
I have an existing php script using base64_encode that works fine and then when i move this script into a new server it doesn't work, the script will just terminate with a blank page. I tried to catch exception try { $encrypted = base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, md5($key), $string, MCRYPT_MODE_CBC, md5(md5($key)))); } catch(Exception...

update qyery for updating a Base64 Image string in android

php,android,android-asynctask,base64,mysql-real-escape-string
i have a php page which is having a update query to update image $email=$_POST['email']; $name = $_POST['name']; $phone= $_POST['mobile']; $buffer = mysql_real_escape_string($_POST['image']); $user_image = base64_decode($buffer); require_once __DIR__ . '/db_connect.php'; $db = new DB_CONNECT(); $q="UPDATE register SET name ='$name', user_image ='$userimage', phone_number = '$phone' WHERE register.email ='$email'"; if ($result) {...

Python base32 data decode

python,base64
I am not able to understand why import base64 base64.b32decode('siddh===', casefold=True); works but base64.b32decode('siddha==', casefold=True); throws TypeError: Incorrect padding ...

Why do these base64 encoding outputs differ, given the same input string?

javascript,groovy,go,base64,gnu
When getting a bas64 encoded string from the same input string I find that JavaScript, Groovy, and Go have the same result, but GNU base64 is slightly different. Why is that? JavaScript (nodejs v0.10.33): new Buffer('Laurence Tureaud is Mr. T').toString('base64'); TGF1cmVuY2UgVHVyZWF1ZCBpcyBNci4gVA== Groovy (2.3.7 on Java 8): 'Laurence Tureaud is Mr....

file is always empty if I use ReadElementContentAsBase64

c#,xml,monotouch,base64,xmlreader
I'm using XmlReader to parse a XML document. One of the nodes contains base64 encoded data and I want to decode it. This is what I do: byte[] buffer = new byte[4096]; int readBytes = 0; using (FileStream outputFile = File.OpenWrite (path)) using (BinaryWriter bw = new BinaryWriter (outputFile)) {...

TypeError: 'Weather' object is not callable

python,tkinter,base64
I'm very new to programming so please excuse me if I lack the correct terminology. I'm trying to retrieve an image from a website and post it onto a GUI with tkinter. It works, insofar as it posts the image on the GUI; however it still produces an error as...

passing base64 image string in xml tag

javascript,jquery,xml,xml-parsing,base64
I tried this code, but it is not working. Any suggestions or any solutions for above issue for sending base64 string in xml tag. I have searching lot of about base64 string passing to java server using this xml tags(i.e. xml parsing) but not get any results. function fileSelectedForLogo() {...

Resize image before sending to BASE64 (without using img element)

javascript,php,base64
EDIT: I dont want to show the image on the client, the purpose is to shrink the image and scale... Im having some trouble resizing an image which is selected using a file input in a form before it must be uploaded to the server. I have the following code...

firefox svg canvas drawImage error

firefox,svg,base64,drawimage
I am trying to convert a external svg icon to base64. It is working in all browsers except Firefox which throws an error "NS_ERROR_NOT_AVAILABLE". var img = new Image(); img.src = "icon.svg"; img.onload = function() { var canvas = document.createElement("canvas"); canvas.width = this.width; canvas.height = this.height; var ctx = canvas.getContext("2d");...

Why is it a common practice to encode pagination cursors or id values as string?

facebook-graph-api,design,cursor,base64
For example the Facebook Graph API: why are after and before base64 encoded numbers? { "data": [ ... Endpoint data is here ], "paging": { "cursors": { "after": "MTAxNTExOTQ1MjAwNzI5NDE=", "before": "NDMyNzQyODI3OTQw" }, "previous": "https://graph.facebook.com/me/albums?limit=25&before=NDMyNzQyODI3OTQw" "next": "https://graph.facebook.com/me/albums?limit=25&after=MTAxNTExOTQ1MjAwNzI5NDE=" } } What benefits could it possibly bring in contrast to just plain numbers?...

Create image from base64 encoded string [closed]

ios,xcode,swift,uiimageview,base64
A web service echoes a base64 encoded image as a string. How can one display this encoded image in a Swift project? Specifically, I would like to take an image, which is already provided by the web service as a string in base64 format, and understand how to display it...

Is a base64 encoded string unique?

encoding,base64
I can't find an answer to this. If I encode a string with Base64 will the encoded output be unique based on the string? I ask because I want to create a token which will contain user information so I need make sure the output will be unique depending on...

How to convert base64 string into an audio mp3 file?

php,audio,base64,mp3
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...

Serialize binary field django rest framework

serialization,base64,django-rest-framework
I'm having difficulties to save a Base64 string through a serializer. I'm using django rest framework 2.4 and django 1.7. The model and serializer are as follow: models.py class TicketAttachmentAreas(models.Model): id = models.AutoField(primary_key=True) ticket = models.ForeignKey(Tickets) attachment_file = models.ForeignKey(AttachmentFiles, related_name='areas') x1 = models.IntegerField(blank=True, null=True) x2 = models.IntegerField(blank=True, null=True) y1 =...

Decode base64 filestream with FromBase64Transform

c#,file,base64
The example from MSDN seems to read the whole file into memory. I don't want that. The file should be processed block by block. Therefore I tried to rewrite the example: using (FromBase64Transform myTransform = new FromBase64Transform (FromBase64TransformMode.IgnoreWhiteSpaces)) { byte[] transformBuffer = new byte[myTransform.OutputBlockSize]; using (FileStream inputFile = File.OpenRead("/path/to/file/47311.b64")) {...

How do i encrypt password in three layers , SHA1, base64 encode and salt

java,base64,sha1,salt,password-encryption
I want to encrypt and decrypt password with high security . First, the string password with be converted to SHA1 , then i also want to add base64 encode and lastly add SALT to it. Is this doable in java? I have sample code to encode in base64 and sha1...

Why JDK8's Base64 uses ISO-8859-1?

character-encoding,base64,ascii,java-8,iso-8859-1
I'm writing my own BASE64 encoder/decoder for some constrained environments. And I found that Base64.Encoder#encodeString saying that it uses ISO-8859-1 for construct a String from those encoded bytes. I perfectly presuming that ISO-8859-1 charset also covers all base64 alphabets. Is there any possible reason not to use US-ASCII?...