vb.net - Decrypt a file with PHP (3DES) -
i need decrypt file php, being encrypted in vb.net, , vice versa.
imports system.io imports system.security.cryptography imports system.text public class encryptionanddecryptionclass public key(15) byte private vector() byte = {&h12, &h44, &h16, &hee, &h88, &h15, &hdd, &h41, &h12, &h44, &h16, &hee, &h88, &h15, &hdd, &h41} function decrypt(byval data() byte) string dim memorystream new memorystream(data) dim csdecrypt new cryptostream(memorystream, new tripledescryptoserviceprovider().createdecryptor(key, vector), cryptostreammode.read) dim fromencrypt(data.length) byte csdecrypt.read(fromencrypt, 0, fromencrypt.length) return new utf8encoding().getstring(fromencrypt) end function function encrypt(byval data string) byte() dim memorystream new memorystream dim cstream new cryptostream(memorystream, new tripledescryptoserviceprovider().createencryptor(key, vector), cryptostreammode.write) dim toencrypt byte() = new utf8encoding().getbytes(data) cstream.write(toencrypt, 0, toencrypt.length) cstream.flushfinalblock() dim ret byte() = memorystream.toarray() cstream.close() memorystream.close() return ret end function sub createkey(byval strkey string) dim arrbyte(15) byte dim ascencod new utf8encoding dim integer = 0 ascencod.getbytes(strkey, i, strkey.length, arrbyte, i) dim hashsha new sha1cryptoserviceprovider dim arrhash() byte = hashsha.computehash(arrbyte) = 0 15 key(i) = arrhash(i) next end sub end class this code in vb, encrypts , decrypts strings, not in php code same. in php.
do know php code can read encrypted data above code?
Comments
Post a Comment