Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class Aes128CBCEncryptor
- {
- const METHOD = 'aes-128-cbc';
- const BLOCK_SIZE = 16;
- const KEY_TOKEN = 'klucz szyfrujacy';
- const IV = "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00";
- public static function getKey()
- {
- return sha1(self::KEY_TOKEN);
- }
- public static function encrypt($text)
- {
- return openssl_encrypt($text, self::METHOD, self::getKey(), OPENSSL_RAW_DATA, self::IV);
- }
- public static function decrypt($text)
- {
- return openssl_decrypt($text, self::METHOD, self::getKey(),OPENSSL_RAW_DATA, self::IV);
- }
- public static function paddingOracleCheck($cipheredText)
- {
- $text = self::decrypt($cipheredText);
- return boolval($text);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement