SHARE
TWEET

Untitled

a guest Oct 21st, 2019 87 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. class Aes128CBCEncryptor
  4. {
  5.     const METHOD = 'aes-128-cbc';
  6.     const BLOCK_SIZE = 16;
  7.     const KEY_TOKEN = 'klucz szyfrujacy';
  8.     const IV = "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00";
  9.  
  10.     public static function getKey()
  11.     {
  12.         return sha1(self::KEY_TOKEN);
  13.     }
  14.  
  15.     public static function encrypt($text)
  16.     {
  17.         return openssl_encrypt($text, self::METHOD, self::getKey(), OPENSSL_RAW_DATA, self::IV);
  18.     }
  19.  
  20.     public static function decrypt($text)
  21.     {
  22.         return openssl_decrypt($text, self::METHOD, self::getKey(),OPENSSL_RAW_DATA, self::IV);
  23.     }
  24.  
  25.     public static function paddingOracleCheck($cipheredText)
  26.     {
  27.         $text = self::decrypt($cipheredText);
  28.         return boolval($text);
  29.     }
  30. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top