Link to home
Start Free TrialLog in
Avatar of ShinZan
ShinZan

asked on

Code Request Encrypt and Decrypt using XOR for PHP And VB6

I have been looking around for an algorithm that will encrypt a string and decrypt a string using a key.

This would require 4 functions that impliment the same algorithm in VB6 and PHP

php_DecryptValue(Cypher,Key)
php_DecryptValue(Cypher,Key)
vb6_EncryptValue(Cypher,Key)
vb6_DecryptValue(Cypher,Key)

I've seen some XOR for encrypt in both langs but I just need something quick painless and not overly powerful that i can just drag and drop.  Can anyone help?
Avatar of Beverley Portlock
Beverley Portlock
Flag of United Kingdom of Great Britain and Northern Ireland image

If yur PHP installation has the mcrypt extension installed then that is probably what you need

http://www.php.net/mcrypt

http://uk3.php.net/manual/en/mcrypt.examples.php

I should add that if you want to encrypt and pass from VB to PHP and then decrypt then you need a common cypher. Blowfish is common to both but a list of PHP cyphers is at http://uk3.php.net/manual/en/mcrypt.ciphers.php

If you merely want to pass info securely over HTTP then maybe using HTTPS would be an option?
Avatar of ShinZan
ShinZan

ASKER

I need a code sample as the above 4 procdure declarations
Avatar of ShinZan

ASKER

I know I need a common cypher i am looking for straight cut and paste code of a common cyper in VB6 and php it can use XOR and be simple
SOLUTION
Avatar of ShinZan
ShinZan

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ShinZan

ASKER

Cut and paste code what else can you ask for
Your original question was not clear enough. I took it to mean that you needed a common set of encryption functions that work in both PHP and VB. I did not expect to write them from scratch.

Good luck with your project.

Avatar of ShinZan

ASKER

sorry but i even gave function delcarations and asked for copy paste code thats pretty clear i thought
Function declarations like those you gave are often presented to us here as function prototypes or examples of how the data should be passed or what the OP is looking to do. The links I gave to PHP's mcrypt mirrors your function definitions which is what I though you were looking for. For example,

mcrypt_generic($td, $input);

php_DecryptValue(Cypher,Key)


Also your original post does not contain either of  the words copy or paste. Regardless of how you thought you had explained it, I am telling you how it read to me.