+ 5
What language can be used to write decryption algorithms for security systems
6 Answers
+ 7
Nearly all programming languages can be used for a decryption and encryption algorithm.
https://github.com/Yeo-Wen-Qin/VigenereCipher
There is a simple one made by me in C#.
+ 5
thanks @ Sam tezel
+ 1
<?php
$input= $_POST['input'];
$td = mcrypt_module_open('rijndael-256', '', 'ofb', '');
$iv = mcrypt_create_iv(mcrypt_enc_get_iv_size($td), MCRYPT_DEV_RANDOM);
$ks = mcrypt_enc_get_key_size($td);
/* Create key */
$key = substr(md5('somesecretkeyhere'), 0, $ks);
/* Intialize encryption */
mcrypt_generic_init($td, $key, $iv);
/* Encrypt data */
$encrypted = mcrypt_generic($td, $input);
/* Terminate encryption handler */
mcrypt_generic_deinit($td);
mcrypt_module_close($td);
$encrypted = base64_encode($encrypted);
$iv = base64_encode($iv);
$ks = base64_encode($ks);
$secretkey = base64_encode('somesecretkeyhere');
?>
<form method="POST" action=''>
ENTER TEXT TO ENCRYPT <input style="width:275px; height:30px;" type="text" id="mytext5" name="input" value="" /><br>
<button style="width:300px; height:35px; background:transparent; border:none; color:black; font-size:16px; text-align-last:center;font-weight: bold;text-decoration: underline; ">SUBMIT TEXT TO ENCRYPT</button>
<input type="submit" name="formSubmit" value="Submit" style="display:none;" >
</form>
<form method="POST" action=<?php echo 'mcrypt2.php';?> >
ENCRYPTED TEXT (base64)<br> <input style="width:275px; height:30px;" type="text" id="mytext5" name="encrypted" value="<?php echo $encrypted;?>" /><br>
RANDOM INIT VECTOR (base64) <br><input style="width:275px; height:30px;" type="text" id="mytext5" name="iv" value="<?php echo $iv;?>" /><br>
LENGTH (base64)<br><input style="width:275px; height:30px;" type="text" id="mytext5" name="ks" value="<?php echo $ks;?>" /><br>
SECRET KEY Not Held In Database, Held in programmming pages to decrypt (change to see that decrypt wont work) <br><input style="width:275px; height:30px;" type="text" id="mytext5" name="secretkey" value="<?php echo $secretkey;?>" /><br>
<button style="width:300px; height:35px; background:transparent; border:none; color:black; font-size:16px; text-align-last:center;font-weight: bold;text-decor
+ 1
2nd page.....
<?php
$secretkey= $_POST['secretkey'];
$secretkey = base64_decode($secretkey);
$encrypted2= $_POST['encrypted'];
$encrypted= $_POST['encrypted'];
$encrypted = base64_decode($encrypted);
$iv = $_POST['iv'];
$iv = base64_decode($iv);
$ks = $_POST['ks'];
$ks = base64_decode($ks);
$td = mcrypt_module_open('rijndael-256', '', 'ofb', '');
$key = substr(md5($secretkey), 0, $ks);
/* Initialize encryption module for decryption */
mcrypt_generic_init($td, $key, $iv);
/* Decrypt encrypted string */
$decrypted = mdecrypt_generic($td, $encrypted);
/* Terminate decryption handle and close module */
mcrypt_generic_deinit($td);
mcrypt_module_close($td);
/* Show string */
echo "Encrypted string : ".trim($encrypted2) . "<br />\n";
echo "Decrypted string : ".trim($decrypted) . "<br />\n";
?>
+ 1
rest of page on that did'nt fit in the first response....
ation: underline; ">DECRYPT</button>
<input type="submit" name="formSubmit" value="Submit" style="display:none;" >
</form>
+ 1
np