简体   繁体   English

将md5 vb.net编码更改为php

[英]change coding md5 vb.net into php

I have code BV.net like these 我有这样的代码BV.net

Dim md5 As New MD5CryptoServiceProvider
Dim des As New TripleDESCryptoServiceProvider

des.Key = MD5Hash(key)
des.Mode = CipherMode.ECB

Dim buffer As Byte() = ASCIIEncoding.ASCII.GetBytes(input)
Return Convert.ToBase64String(des.CreateEncryptor().TransformFinalBlock(buffer, 0, buffer.Length))

My problem is, i wanna make php md5 but when i try compare is not matching. 我的问题是,我想制作php md5,但是当我尝试比较时却不匹配。

Like these 像这些

echo md5('111');

result on php 698d51a19d8a121ce581499d7b701668 but on vb.net result is M+wq3Qt9bfg=. php 698d51a19d8a121ce581499d7b701668上的结果,但在vb.net上结果为M+wq3Qt9bfg=. So i dont have any idea how to make my md5 on php get value like on vb.net. 因此,我不知道如何使php上的md5像vb.net上那样获得价值。 Any idea about these?? 有这些想法吗?

NOTE : the code vb.net not mine build but is my friend build it. 注意:代码vb.net不是我的构建,而是我的朋友构建的。

I dont think I fully understand this, but, Return Convert.ToBase64String(des.CreateEncryptor().TransformFinalBlock(buffer, 0, buffer.Length)) Return a symmetric encryptor object converted to Base64 string. 我不认为我完全理解这一点,但是, Return Convert.ToBase64String(des.CreateEncryptor().TransformFinalBlock(buffer, 0, buffer.Length))返回一个对称的加密对象,该对象转换为Base64字符串。

While your php code echo md5('111'); 当您的PHP代码echo md5('111'); returns md5 sum in hex format. 以十六进制格式返回md5 sum。 You can convert the md5 output to base64 but I dont think it will work as the output from VB.net is that of an encryptor object not MD5sum 您可以将md5输出转换为base64,但我认为它不会工作,因为VB.net的输出是加密对象而不是MD5sum的输出

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM