Ejemplo n.º 1
0
function decoder($x)
{
    $Cipher = new AES();
    $key_256bit = $keypass;
    $n = ceil(strlen($x) / 32);
    $decrypt = "";
    for ($i = 0; $i <= $n - 1; $i++) {
        $result = $Cipher->decrypt(substr($x, $i * 32, 32), $key_256bit);
        $decrypt .= $Cipher->hexToString($result);
    }
    $value = new hash_encryption($keypass1);
    $decrypted = $value->decrypt($decrypt);
    return $decrypted;
}
Ejemplo n.º 2
0
 function securityDecryptString($plaintext)
 {
     $plaintext = base64_decode($plaintext);
     $plaintext = CI::library('encrypt')->decode($plaintext);
     return $plaintext;
     $the_pass = $this->optionsGetByKey('ecnryption_hash');
     //$the_pass = intval ( $the_pass );
     require_once 'crypt/class.hash_crypt.php';
     $the_pass = CI::library('session')->userdata('session_id');
     //$the_pass = $this->optionsGetByKey ( 'ecnryption_hash' );
     $crypt = new hash_encryption($the_pass);
     $encrypted = $crypt->decrypt($plaintext);
     return $encrypted;
 }
Ejemplo n.º 3
0
?>
" />
				</td>
			</tr>
		</table>
		<input type="submit" name="encrypt" value="Encrypt playintext" />
	</form>
	<hr>
<?php 
// Did the user submit our form?
if (isset($_POST['encrypt'])) {
    $html = '';
    // Include class file
    require_once 'class.hash_crypt.php';
    // Instantiate new hash_encryption object, feed password
    $crypt = new hash_encryption($password);
    // Do the encryption
    $encrypted = $crypt->encrypt($plaintext);
    // Convert ciphertext for convenient screen presentation: add linebreak every 80 chars
    $encrypted_output = '';
    $count = 0;
    while ($count < strlen($encrypted)) {
        $encrypted_output .= substr($encrypted, $count, 80) . "<br>";
        $count += 80;
    }
    // Prepare html output
    $html .= '<p>Ciphertext:</p>';
    $html .= '<p style="border: 1px solid black">' . $encrypted_output . '</p>';
    $html .= '<p>By the way: The ciphertext decrypts to the following message using your password "' . htmlentities($password) . '":</p>';
    // Let's decrypt the ciphertext again
    $decrypted = $crypt->decrypt($encrypted);