faqts : Computers : Programming : Languages : PHP : Installation and Setup : Operating Systems : Windows

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

23 of 31 people (74%) answered Yes
Recently 4 of 10 people (40%) answered Yes

Entry

Encrypt & decrypt functions under Windows

Mar 9th, 2000 13:24
Kris Kumler,


Ok, after looking at the source code to get the syntax for using the 
encrypt() & decrypt() functions as under php3_crypt.dll (it nicely 
placed in the comment field), I have been successful.  

(string) encrypt(data,type,key)
(string) decrypt(data,type,key)

	encrypts or decrypts data
	(string)data
	(int)type
	(string)key

	type can be 0 to 3:
	IDEA = 0
	MDC = 1
	DES = 2
	XOR = 3

    IDEA      data is at least 8 bytes long, key is 16 bytes.
    MDC       data is at least 8 bytes long, key is 8 bytes.
    DES       data is at least 32 bytes long, key is 16 bytes.
    XOR       data is at least 16 bytes long, key is 16 bytes.

  returns encrypted or decrypted string.

So you're going to have to throw in your own key.  Keep in mind, this 
is a two-way encryption.  A replacement for the UNIX crypt() function 
(which uses a one-way algorithm) should be used if you really don't 
want anyone getting this information.  If someone recovered your key, 
then they would be able to, for example, decrypt a password list.