@@ 111-121 (lines=11) @@ | ||
108 | * @param string $key Encryption key |
|
109 | * @return string Resulting ciphertext |
|
110 | */ |
|
111 | private function encryptBlock($input, $key) { |
|
112 | if (!$input && !$key) { |
|
113 | return ''; |
|
114 | } |
|
115 | ||
116 | $this->prepareCipher($key); |
|
117 | $result = mcrypt_generic($this->mcrypt, $input); |
|
118 | mcrypt_generic_deinit($this->mcrypt); |
|
119 | ||
120 | return $result; |
|
121 | } |
|
122 | ||
123 | /** |
|
124 | * Derypts a block using the suppied key |
|
@@ 130-140 (lines=11) @@ | ||
127 | * @param string $key Encryption key |
|
128 | * @return string Resulting plaintext |
|
129 | */ |
|
130 | private function decryptBlock($input, $key) { |
|
131 | if (!$input && !$key) { |
|
132 | return ''; |
|
133 | } |
|
134 | ||
135 | $this->prepareCipher($key); |
|
136 | $result = mdecrypt_generic($this->mcrypt, $input); |
|
137 | mcrypt_generic_deinit($this->mcrypt); |
|
138 | ||
139 | return $result; |
|
140 | } |
|
141 | ||
142 | /** |
|
143 | * Sets up the mcrypt module |