It´s not a big deal to mimic the websocket connection made to bittrex from www, using chromes dev tools:
GET https://socket.bittrex.com/signalr/negotiate?clientProtocol=1.5&connectionData=%5B%7B%22name%22%3A%22c2%22%7D%5D&_=1524596108843
This return a token
"ConnectionToken":"gbLsm8C6Jck1mQTTFjmuIv5qgUuMZz/kXU1s+fAnjnWqUFQocNBfp3VOrd/y0acxWL5Fv7MZ54heRddLYZS+EMhLnaPPQiSZblvgJPCbLKqZTIkb"
That needs to be used with:
wss://socket.bittrex.com/signalr/connect? transport=webSockets&clientProtocol=1.5&connectionToken=
Then there are some commands sent to the websocket:
{"H":"c2","M":"SubscribeToSummaryLiteDeltas","A":[],"I":0}{"H":"c2","M":"SubscribeToExchangeDeltas","A":["BTC-TRX"],"I":1}{"H":"c2","M":"QueryExchangeState","A":["BTC-TRX"],"I":2}
Which makes bittrex stream data about the selected ticker, BTC-TRX. But here´s where things start to get odd:
Here´s what frames look like:
{"C":"d-C95D047D-E,0|OHjr,0|OHjs,2|CW,6116","M":[{"H":"C2","M":"uE","A":["dY+7DsIwDEX/xXOI7NiOnYwwg0TpwENd+QnUfydtBQKp9ear4yPfFxyhwr4/7PruCgFOUJO4SoA71McL+lsLAnRQMeI0xhzg3EKXQpEFzUvyMayhiWaUOJtqLCZKonkcAly+cvyXl/lCHKOyaxbDdbUuamMXzhELk5lvvKE+s0yoyWPKVIhwg81LO8OcNCZOGQn5g9IPSuyLtq1To2drNIxv"]}]}
It certainly looks like base64, but decoding it gives me something like:
u���0E��s��؎��0�D��C]� �'m����#��¾?���NP��J�;���[tP1�4���B�B��K�1���f�8�j,&J�y\�r����B��k�u�.jc���o��>�L��c�T�p��K;Ü4&N ���J싶�S�gk4�o
Did anyone figure out how to turn this into readable data?
my issue is when I try to encode an image to base-64, it generate a long string (up to 200,000 lines) and it doesn't work in the decoding, it generate a nil image! even I try to resize the image to a smaller size but still it doesn't work!
Here is my image encoding code
let image = imageView.imagelet imageData:NSData = UIImagePNGRepresentation(image!)! as NSDatalet strBase64 = imageData.base64EncodedString(options: .lineLength64Characters)
The decoding code:
let processImage = user.value(forKey: "processImage") as! String // image from json if let dataDecoded:NSData = NSData(base64Encoded: processImage, options: NSData.Base64DecodingOptions.ignoreUnknownCharacters) { let image: UIImage = UIImage(data:dataDecoded as Data,scale:1.0)! print(image.size) self.myImage.image = image }
I was wondering if it's possible to transfer arbitrary binary data through messaging apps such as Telegram. I guess the question is if binary data can be transferred through text messages. I read somewhere that this is possible if Base64 binary-to-text encoding is used. Telegram is a platform which is not censored in the country I'm living in. So, if I can relqy binary data through telegram, it can be used to bypass censorship. Does telegram support Base64 encoding? What are your thoughts on this?
I'm trying to encode/decode a file that is several MBs or sometimes GBs in base64 encoding however some pieces of data gets encoded/decoded in a wrong way which results in strange characters like: � �̴.
I'm reading the file chunk by chunk encrypting and saving each individually (Probably that's the problem however i cannot figure it out).
Here is what i have tried so far:
<?phpfunction encrypt_file($Ifilename, $Efilename){ $handle = fopen($Ifilename, 'rb'); $outHandle = fopen($Efilename, 'wb'); $bufferSize = 8151; while(!feof($handle)){ $buffer = fread($handle, $bufferSize); $ebuffer = base64_encode($buffer); fwrite($outHandle, $ebuffer); } fclose($handle); fclose($outHandle);}function decrypt_file($Ifilename, $Efilename){ $handle = fopen($Ifilename, 'rb'); $outHandle = fopen($Efilename, 'wb'); $bufferSize = 8151; while(!feof($handle)){ $buffer = fread($handle, $bufferSize); $dbuffer = base64_decode($buffer); fwrite($outHandle, $dbuffer); } fclose($handle); fclose($outHandle);}encrypt_file('input.txt', 'out.bin');//Big text file ~4MBsdecrypt_file('out.bin', 'out.txt');
I am puzzled at this base64 decoding issue, and it seems that python and node.js does this differently. Node does this correctly I believe. Could anyone help point out why python does not work here?
Thank you.
Node
> console.log(Buffer.from('Im3Osc6_z4HPgc-J==', 'base64').toString());"mαορρω
Python
>>> from base64 import decodestring>>> print decodestring('Im3Osc6_z4HPgc-J==')"mαγ?s?p
Koti - Sivukartta - Yksityisyys - Linkit - Copyright © 2018 Cortex IT Ltd : Yhteyshenkilö : admin @ cortexit.co.uk
Please note that by viewing our site you agree to our use of cookies (see Yksityisyys for details). You will only see this message once.