src/bbn/util/enc.php
public static function encryptOpenssl($textToEncrypt, string $secretHash = null, string $password = ''): ? string
  {
    if ( !$secretHash ){
      $secretHash = self::$salt;
    }
    if ( $length = openssl_cipher_iv_length(self::$method) ){
      $iv = substr(md5(self::$prefix.$password), 0, $length);
      return openssl_encrypt($textToEncrypt, self::$method, $secretHash, true, $iv);
    }
    return null;
  }
public static function encryptOpenssl($textToEncrypt, string $secretHash = null, string $password = ''): ? string
  {
    if ( !$secretHash ){
      $secretHash = self::$salt;
    }
    if ( $length = openssl_cipher_iv_length(self::$method) ){
      $iv = substr(md5(self::$prefix.$password), 0, $length);
      return openssl_encrypt($textToEncrypt, self::$method, $secretHash, true, $iv);
    }
    return null;
  }
public static function encryptOpenssl ( $ textToEncrypt , string $ secretHash = null , string $ password = '' ) : ? string { if ( ! $ secretHash ) { $ secretHash = self :: $ salt ; } if ( $ length = openssl_cipher_iv_length ( self :: $ method ) ) { $ iv = substr ( md5 ( self :: $ prefix . $ password ) , 0 , $ length ) ; return openssl_encrypt ( $ textToEncrypt , self :: $ method , $ secretHash , true , $ iv ) ; } return null ; }
Encrypt string using openSSL module
@param string $textToEncrypt
@param string $secretHash Any random secure SALT string for your website
@param string $password User's optional password
@return null|string
Encrypt string using openSSL module