Public feed #599966

Stuff

public text v1 · immutable
Raw Edit
·published 2007-07-02 15:16 UTC
rendered paste body
function encrypt($string, $key)
{	
	$encrypted = array();

	$encrypted['InitializationVector'] = mcrypt_create_iv(mcrypt_get_iv_size(ENCRYPTION_CIPHER_ALGORITHM, MCRYPT_MODE_ECB), MCRYPT_RAND);
	$encrypted['Encrypted'] = bin2hex(mcrypt_encrypt(ENCRYPTION_CIPHER_ALGORITHM, $key, $string, MCRYPT_MODE_CBC, $encrypted['InitializationVector']));
	$encrypted['InitializationVector'] = bin2hex($encrypted['InitializationVector']);
		
}