简体   繁体   中英

change coding md5 vb.net into php

I have code BV.net like these

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.

Like these

echo md5('111');

result on php 698d51a19d8a121ce581499d7b701668 but on vb.net result is M+wq3Qt9bfg=. So i dont have any idea how to make my md5 on php get value like on vb.net. Any idea about these??

NOTE : the code vb.net not mine build but is my friend build it.

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.

While your php code echo md5('111'); returns md5 sum in hex format. 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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