base64

Saving a Base64 string to disk as a binary using Delphi 2007

你。 提交于 2019-12-30 07:45:53
问题 I have a Base64 binary string that is part of an XML document that is sent to us by a 3rd party supplier, I would like to be able to save it back to its original file format (jpg). Using the accepted answer from this question "saving a base64 string to disk as a binary using php" I can save the string to a jpg with little effort, so I know the string is in good form and is a JPG file. But how do I do this in Delphi 2007? Looking on the net I found a tutorial on how to convert the Base64 into

Saving a Base64 string to disk as a binary using Delphi 2007

左心房为你撑大大i 提交于 2019-12-30 07:45:19
问题 I have a Base64 binary string that is part of an XML document that is sent to us by a 3rd party supplier, I would like to be able to save it back to its original file format (jpg). Using the accepted answer from this question "saving a base64 string to disk as a binary using php" I can save the string to a jpg with little effort, so I know the string is in good form and is a JPG file. But how do I do this in Delphi 2007? Looking on the net I found a tutorial on how to convert the Base64 into

Byte array into an image Node.js

♀尐吖头ヾ 提交于 2019-12-30 07:17:01
问题 I have a long array of bytes, with numbers from 0 to 255, and I know it's an image, so how can I save it like a file? I have tried a lot of things, but not success. The image is created but won't open because it's damaged. File .js function saveImage(filename, data){ //Data = [1,6,2,23,255,etc] var wstream = fs.createWriteStream(ARTWORK_PATH+filename); for (var i = 0; i < data.length; i++) { wstream.write(data[i].toString('base64')); } wstream.end(); } 回答1: Why use base64 encoding? If your

Byte array into an image Node.js

眉间皱痕 提交于 2019-12-30 07:16:02
问题 I have a long array of bytes, with numbers from 0 to 255, and I know it's an image, so how can I save it like a file? I have tried a lot of things, but not success. The image is created but won't open because it's damaged. File .js function saveImage(filename, data){ //Data = [1,6,2,23,255,etc] var wstream = fs.createWriteStream(ARTWORK_PATH+filename); for (var i = 0; i < data.length; i++) { wstream.write(data[i].toString('base64')); } wstream.end(); } 回答1: Why use base64 encoding? If your

Are there multiple formats of In App Billing transactions?

冷暖自知 提交于 2019-12-30 07:12:09
问题 We're having problems verifying some of payment transactions (Google In App Billing V3). It looks like data of cumbersome transactions follows a different format than what we can see in transactions we have no problems verifying. Transactions that we are able to verify OrderId : Two numbers separated with a dot: 92299713162054702728.1224255970239541 Signature : Always includes base64 padding at the end, 345 characters long Transactions that fail to verify OrderId : One number:

Reliably checking if a string is base64 encoded in .Net

回眸只為那壹抹淺笑 提交于 2019-12-30 07:11:53
问题 Before I start: Yes, I have checked the other questions and answers on this topic both here and elsewhere. I have found an example string that the .Net will base64 decode even though it isn't actually base64 encoded. Here is the example: Rhinocort Aqueous 64mcg/dose Nasal Spray The .Net method Convert.FromBase64String does not throw an exception when decoding this string so my IsBase64Encoded method happily returns true for this string. Interestingly, if I use the cygwin base64 -d command

PHP sending encrypted data via the URL

久未见 提交于 2019-12-30 06:12:08
问题 I'm trying to send encrypted data over the url to another site (using file_get_contents("anotherUrl.php?hash=$encryptedString") . The problem is, sometimes, the encryption contains some special characters, like +, and this causes the decryption to fail. Here are my encryption / decryption methods: public function encrypt($string, $key) { return base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, md5($key), $string, MCRYPT_MODE_CBC, md5(md5($key)))); } public function decrypt($encrypted, $key) {

convert file to base64 function output

微笑、不失礼 提交于 2019-12-30 05:02:31
问题 Public Function ConvertFileToBase64(ByVal fileName As String) As String Dim ReturnValue As String = "" If My.Computer.FileSystem.FileExists(fileName) Then Using BinaryFile As FileStream = New FileStream(fileName, FileMode.Open) Dim BinRead As BinaryReader = New BinaryReader(BinaryFile) Dim BinBytes As Byte() = BinRead.ReadBytes(CInt(BinaryFile.Length)) ReturnValue = Convert.ToBase64String(BinBytes) BinaryFile.Close() End Using End If Return ReturnValue End Function The questions I want to ask

how to tell if a string is base64 or not

时光毁灭记忆、已成空白 提交于 2019-12-30 04:46:05
问题 I have many emails coming in from different sources. they all have attachments, many of them have attachment names in chinese, so these names are converted to base64 by their email clients. When I receive these emails, I wish to decode the name. but there are other names which are not base64. How can I differentiate whether a string is base64 or not, using the jython programming language? Ie. First attachment: ------=_NextPart_000_0091_01C940CC.EF5AC860 Content-Type: application/vnd.ms-excel;

binary data in database, blob vs compressed base64

狂风中的少年 提交于 2019-12-30 04:01:24
问题 There is a column type named blob in database, and it is used to store binary data. But more often than not, I see solutions which compress binary data, then convert binary data to base64, and store base64 string as varchar or text in database. Python code example: import zlib, base64 base64_str = base64.b64encode(zlib.compress(binary_data, 9)) So there are two ways to store binary data into database: as blob as compressed base64 My Questions is: Which way is better and why? 回答1: It seems