English 中文(简体)
如何解密 PHP 页面中的三维 DES 字符串?
原标题:How to decrypt a triple DES string in PHP page?

我希望有人能帮助一个非PHPP开发商,提供如何解密三重 DES URL Encodd 字符串(例如,在名为“q”的查询字符串变量中传给页面)的示例。

键是 24 位,内向矢量是 8 位。

C # 中的原始数据是:

  1. UTF-8 encoded as a byte array
  2. Encrypted with the key and IV
  3. Encoded as a Base 64 string
  4. URL encoded as a string

.

byte[] rawData;
TripleDES tripleDESalg = TripleDES.Create();
rawData = UTF8Encoding.UTF8.GetBytes(message);
ICryptoTransform cTransform = tripleDESalg.CreateEncryptor(key, IV);
byte[] resultArray = cTransform.TransformFinalBlock(rawData, 0, rawData.Length);
tripleDESalg.Clear();
encryptedText = Convert.ToBase64String(resultArray);

.

在PHP页面上,

  1. Decode the URL encoded string in the querystring variable "q"
  2. Decode the Base 64 encoded string (e.g. base64_decode)
  3. Decrypt the value using the same key and iv that was used to encrypt it (assume you control the encrypting and decrypting and both system know what the key and iv are)
  4. Print/echo the output

最佳回答

<% 1\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

$string = $_REQUEST[q];

<强度>URL decode

"http://php.net/manual/en/form.urldecode.php" rel="nofollow"\\code>urldecode

<强 > 基础64Deccode

base64_decode

<强度 > 清除

使用 < a href=>" "http://php.net/manual/en/formation.mcrypt- decrypt.php" rel="nofollow"\\ code>mcrypt_decrypt 。

对于第一个参数,您可以通过密码(Ciphers列表 ),在您的情况下,密码为MCRYPT_DES

其余参数将是密码、密钥、iv等。

PHP 手册是详尽无遗的。使用它。

问题回答

暂无回答




相关问题
Extend Contacts application on Android to provide encryption

I want to encrypt individual contacts stored by the Contacts application on Android based on user s preference. So, I am thinking I ll have to hook/extend the Contacts application before the it stores ...

Make md5 strong

Im making a website that will intergrate with game that only support md5 hashing metod (atm). Which ofc is not especially safe anymore. But how could i make it stronger? Should I just generate long ...

How to Pack/Encrypt/Unpack/Decrypt a bunch of files in Java?

I m essentially trying to do the following on a Java/JSP-driven web site: User supplies a password Password is used to build a strongly-encrypted archive file (zip, or anything else) containing a ...

Thread & Queue vs Serial performance

I though it ll be interesting to look at threads and queues, so I ve written 2 scripts, one will break a file up and encrypt each chunk in a thread, the other will do it serially. I m still very new ...

Convert PHP encryption code to C#

I m trying to convert this piece of code from PHP to C#. It s part of a Captive Portal. Could somebody explain what it does? $hexchal = pack ("H32", $challenge); if ($uamsecret) { $newchal = ...

Encryption: how to have 1 iv despite multiple fields

I ve been stuck trying to arrive at a best solution for this for a while. I know that an initialization vector has to be unique for each item being encrypted. So if I m encrypting an address and I ...

热门标签