decode

Need help with PHP URL encoding/decoding

本小妞迷上赌 提交于 2019-12-06 07:34:10
On one page I'm "masking"/encoding URL which is passed to another page, there I decode URL and start file delivering to user. I found some function for encoding/decoding URL's, but sometime encoded URL contains "+" or "/" and decoded link is broken. I must use "folder structure" for link, can not use QueryString! Here is encoding function: $urll = 'SomeUrl.zip'; $key = '123'; $result = ''; for($i=0; $i<strlen($urll); $i++) { $char = substr($urll, $i, 1); $keychar = substr($key, ($i % strlen($key))-1, 1); $char = chr(ord($char)+ord($keychar)); $result.=$char; } $result = urlencode(base64_encode

How to seek in CTR mode and decrypt part of the stream?

怎甘沉沦 提交于 2019-12-06 06:02:11
I have a question in partial decoding in cryptopp. USE AES 256 CTR; Encode source: CTR_Mode< AES >::Encryption e; e.SetKeyWithIV(key, 32, iv); string encrypt; string a = "Example text to encoding"; encrypt.clear(); StringSource s(a, true, new StreamTransformationFilter(e, new StringSink(encrypt) ) ); Decode source: CTR_Mode<AES>::Decryption d; d.SetKeyWithIV(key, 32, iv); string x; StringSource s1(encrypt, true, new StreamTransformationFilter(d, new StringSink(x) ) ); It works fine. But I don't know how decrypt only part. For example, example encrypt.begin()+10 Part Decode: CTR_Mode<AES>:

How rot13 on a string using PHP?

旧巷老猫 提交于 2019-12-06 05:23:08
I have a big php code that i want to encode and decode it manually. My problem is that php code has many single quotes and double quotes inside and because of them i have errors while using str_rot13() function like below... So what is the correct syntax and how can I use the function below for encode: str_rot13 ('That php Code'); And how can i decode that encoded file? I couldn't find a reverse function! thanks in advance The nice thing about rot13 is that it's reflective. applying rot 13 twice (e.g. rot 26) brings you right back to where you came from. Rot 13 is only designed to handle the

How to send a jms message to activeMQ and decode it in javascript with mqttJS properly

不羁岁月 提交于 2019-12-06 02:34:15
问题 I have a java backend, where I can send messages to topics via jmsTemplate.convertAndSend("topic", "Hello World!"); In my javascript frontend I use mqttJS to connect to activeMQ and recieve the massage: let mqtt = require('mqtt') let options ={ clientId:"test", username:"username", useSSL: true, password:"password", clean:true}; let client = mqtt.connect( 'wss://someUrl.com:61619', options); client.on('connect', function () { client.subscribe('myTopic', function (err) { if (!err) { console

行转列之随着记录数增加,列数不固定,且不是多少条行边多少列

情到浓时终转凉″ 提交于 2019-12-06 01:57:19
具体描述不出来,看图片: 附上建表语句: create table TAB1 ( id VARCHAR2(6), iname VARCHAR2(20), sno VARCHAR2(6) ) insert into tab1(id,iname,sno) values('1001','abcde','s001'); insert into tab1(id,iname,sno) values('1002','hijk','s002'); insert into tab1(id,iname,sno) values('1002','hijk','s003'); insert into tab1(id,iname,sno) values('1003','xyz','s001'); insert into tab1(id,iname,sno) values('1003','xyz','s003'); insert into tab1(id,iname,sno) values('1003','xyz','s004'); insert into tab1(id,iname,sno) values('1004','abc','s005'); insert into tab1(id,iname,sno) values('1004','abc','s006'); insert into tab1(id

Efficient decoding of binary and text structures (packets)

帅比萌擦擦* 提交于 2019-12-05 22:59:39
问题 Background There is a well-known tool called Wireshark. I've been using it for ages. It is great, but performance is the problem. Common usage scenario includes several data preparation steps in order to extract a data subset to be analyzed later. Without that step it takes minutes to do filtering (with big traces Wireshark is next to unusable). The actual idea is to create a better solution, fast, parallel and efficient, to be used as a data aggregator/storage. Requirements The actual

Python的str和unicode

a 夏天 提交于 2019-12-05 22:06:17
Python 2和3针对字符串是不一样的。对应关系如下: Python 2.* Python 3.* str unicode bytes str Python3我没有测试,下面主要谈谈Python2上的编码。 Python2中str代表字符串,unicode你懂得。Python内部主要是使用unicode,所以unicode属于内部使用,str是为了给人阅读。 示例(windows中文版环境): >>> sys.version '2.7.8 (default, Jun 30 2014, 16:08:48) [MSC v.1500 64 bit (AMD64)]' >>> s='你好' >>> u=u'你好' >>> s '\xc4\xe3\xba\xc3' >>> u u'\u4f60\u597d' >>> print s 你好 >>> print u 你好 >>> 常用的两个方法: 1 str的decode方法。 2 unicode的encode方法。 由于Python内部语言级别使用unicode,所以一个unicode需要编码(encode)变为str,而反过来str是便于人阅读用的,是从unicode经过encode过来的,所以str的decode方法是变回unicode。 例如: >>> s '\xc4\xe3\xba\xc3' >>> print s 你好 >>> u

Python 普通str字符串 和 unicode 字符串 及字符串编码探测、转换

泪湿孤枕 提交于 2019-12-05 22:05:49
本文研究时的环境是 CentOS release 6.4,内核版本2.6.32-358.el6.x86_64 ,python2.6.6 内容:关于字符串的两个魔术方法 __str__() 、__unicode__() 两个函数 str() 、unicode() 类型转换 encode 、decode 和编码探测 chardet、 cchardet 先看一下对象的两个魔术方法 第一个:object.__ str __( self ) Called by the str() built-in function and by the print statement to compute the “informal” str ing representation of an object. The return value must be a string object. 被 内建函数str() 和 print语句 调用,产生非正式的对对象的描述字符串。返回值必须是string对象(这里指的应该是 bytes object 字节对象) 第二个:object.__unicode__( self ) Called to implement unicode() built-in; should return a Unicode object. When this method is not

php utf-8 decode from xml returns question marks

旧时模样 提交于 2019-12-05 21:29:38
I have some problems using xml. I know this is a comon question, but the answers i found didn't fix my problem. The problem is that when I add é or ä or another special char to my xml file, with php domdocument, it saves the é as xE9 and the ä as xE4. I don't know if this is ok but when I want to show the output it shows question marks at this places. I have tried alot. Like removing and adding the encoding in de xml header in the php domdocument. I also tried using file_get_contents and use php utf-8_decode to get the xml. I tried using iso intead, but nothing solved my problem. Instead I got

How to decode “Content-Encoding: gzip, gzip” using curl?

爱⌒轻易说出口 提交于 2019-12-05 20:18:21
问题 I am trying to decode the webpage www.dealstan.com using CURL by using the below code: $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); // Define target site curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); // Return page in string curl_setopt($cr, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/533.2 (KHTML, like Gecko) Chrome/5.0.342.3 Safari/533.2'); curl_setopt($ch, CURLOPT_ENCODING , "gzip"); curl_setopt($ch, CURLOPT_TIMEOUT,5); curl_setopt($ch,