Encrypt a number?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mettlehead
Forum Newbie
Posts: 15
Joined: Fri Oct 11, 2002 11:03 am
Location: Canada

Encrypt a number?

Post by mettlehead »

Hi,

I have a number like a 16 digit credit card #. I'd like to run some simple (very simple) math algorythm on it to scramble it up, then I need to be able to de scramble it to get the info I need. Hope that makes sense. Any ideas?
SuperHuman
Forum Newbie
Posts: 10
Joined: Wed Oct 16, 2002 10:00 pm

Post by SuperHuman »

Ok, if it is a credit card and you are recieving the number over the web, you are using SSL, correct? If not, you will be in a heap of trouble if the number gets hijacked between the transfer of data...

Now, most PHP host's that provide SSL also have the openssl library compiled in with PHP. So, check out the openssl functions in the manual at php.net as they provide some encryption/decription functions.

If your host does'nt have openssl compiled, your next option would be to use the mcrypt library if it is available or write your own 2-way encryption algorithm...
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

http://www.hotscripts.com has i.e. a link to CryptoMAK.
Note: this is no strong cryptography but it only uses core-php
Post Reply