Пример #1
0
		explicitly when constructing a new instance of <b>QCryptography</b>.<br/><br/>
		
		<b>QCryptography</b> also supports the encryption and decryption of entire files.<br/><br/>

		For more information about the <b>libmcrypt</b> library, please refer to the
		<a href="http://www.php.net/manual/en/ref.mcrypt.php" class="bodyLink">PHP Documentation</a>.<br/><br/>
	</div>

	<h3>TripleDES, Electronic Codebook Encryption</h3>
<?php 
$strOriginal = 'The quick brown fox jumps over the lazy dog.';
// Modify the cipher and base64 mode by modifying the "default" cipher and mode on the class, itself
// Specify a Key (this would typically be defined as a constant (e.g. in _configuration.inc)
QCryptography::$Key = 'SampleKey';
// By default, let's leave Base64 encoding turned off
QCryptography::$Base64 = false;
$objCrypto = new QCryptography();
$strEncrypted = $objCrypto->Encrypt($strOriginal);
$strDecrypted = $objCrypto->Decrypt($strEncrypted);
printf('Original Data: <b>%s</b><br/>', $strOriginal);
printf('Encrypted Data: <b>%s</b><br/>', $strEncrypted);
printf('Decrypted Data: <b>%s</b><br/><br/><br/>', $strDecrypted);
?>



	<h3>TripleDES, Electronic Codebook Encryption (with Base64 encoding)</h3>
<?php 
$strOriginal = 'Just keep examining every low bid quoted for zinc etchings.';
// Modify the base64 mode while making the specification on the constructor, itself
// By default, let's instantiate a QCryptography object with Base64 encoding enabled