User Contributed Notes 2 notes

Ok after having a problem using triple des with .net/visual basic with php I think this could help someone:

Visual Basic 9 with .net 2.0Encrypting as a stream into the IO/Memory as bytesThen they get converted back after encryption

I wanted to use base64 encoding to store the VB encryptionThe problem I found was ...

I could En/Decrypt within VB and PHP just fine But when I tried to encrypt one in VB and decrypt in PHPI got the wrong values with the mcrypt function alone

I found that at least with VB9 that the stream encryption uses a UTF char that is the value for how many missing bytes left in the 8 bit stream.

So if you encrypt 1234 it will add chr(4) four times (the amount of missing bytes)In php use chr otherwise most browsers/client cant read it.Im not good at explaining things but the php code I figured out is below.

It will find the missing bytes on input as visual basic doesand replace as needed. For both encryption and decryption.

Example is triple_des and cbc with self key and iv for storing in base64