<commit_before><?php

namespace Codeko\Redsys\Helper;

class Utilities extends \Magento\Framework\App\Helper\AbstractHelper
{
    
    private $vars_pay = null;
    
    private $ri = null;
    
    public function __construct(
        \Magento\Framework\App\Helper\Context $context,
        \Magento\Framework\Locale\ResolverInterface $ri
    ) {
        $this->ri = $ri;
        parent::__construct($context);
    }

    public function setParameter($key, $value)
    {
        $this->vars_pay[$key] = $value;
    }

    public function getParameter($key)
    {
        return $this->vars_pay[$key];
    }
    
    public function getParameters()
    {
        return $this->vars_pay;
    }

    //////////////////////////////////////////////////////////////////////////////////////////////
    //////////////////////////////////////////////////////////////////////////////////////////////
    ////////////					FUNCIONES AUXILIARES:							  ////////////
    //////////////////////////////////////////////////////////////////////////////////////////////
    //////////////////////////////////////////////////////////////////////////////////////////////

    /**
     * Encrypt 3DES
     *
     * @param  type $message
     * @param  type $key
     * @return type
     */
    private function encrypt3DES($message, $key)
    {
        // Se establece un IV por defecto
        $bytes = [0, 0, 0, 0, 0, 0, 0, 0];
        $iv = implode(array_map("chr", $bytes));
        // Se cifra
        $ciphertext = mcrypt_encrypt(MCRYPT_3DES, $key, $message, MCRYPT_MODE_CBC, $iv);
        return $ciphertext;
    }

    private function base64UrlEncode($input)
    {
        return strtr(base64_encode($input), '+/', '-_');
    }

    private function encodeBase64($data)
    {
        $data = base64_encode($data);
        return $data;
    }

    private function base64UrlDecode($input)
    {
        return base64_decode(strtr($input, '-_', '+/'));
    }

    private function decodeBase64($data)
    {
        $data = base64_decode($data);
        return $data;
    }

    private function mac256($ent, $key)
    {<commit_msg>Fixed error produced by mcrypt_encrypt is deprecated in PHP7.1<commit_after><?php

namespace Codeko\Redsys\Helper;

class Utilities extends \Magento\Framework\App\Helper\AbstractHelper
{
    
    private $vars_pay = null;
    
    private $ri = null;
    
    public function __construct(
        \Magento\Framework\App\Helper\Context $context,
        \Magento\Framework\Locale\ResolverInterface $ri
    ) {
        $this->ri = $ri;
        parent::__construct($context);
    }

    public function setParameter($key, $value)
    {
        $this->vars_pay[$key] = $value;
    }

    public function getParameter($key)
    {
        return $this->vars_pay[$key];
    }
    
    public function getParameters()
    {
        return $this->vars_pay;
    }

    //////////////////////////////////////////////////////////////////////////////////////////////
    //////////////////////////////////////////////////////////////////////////////////////////////
    ////////////					FUNCIONES AUXILIARES:							  ////////////
    //////////////////////////////////////////////////////////////////////////////////////////////
    //////////////////////////////////////////////////////////////////////////////////////////////

    /**
     * Encrypt 3DES
     *
     * @param  type $message
     * @param  type $key
     * @return type
     */
    private function encrypt3DES($message, $key) {
        $l = ceil(strlen($message) / 8) * 8;
        return substr(openssl_encrypt($message . str_repeat("\0", $l - strlen($message)), 'des-ede3-cbc', $key, OPENSSL_RAW_DATA, "\0\0\0\0\0\0\0\0"), 0, $l);
    }

    private function base64UrlEncode($input)
    {
        return strtr(base64_encode($input), '+/', '-_');
    }

    private function encodeBase64($data)
    {
        $data = base64_encode($data);
        return $data;
    }

    private function base64UrlDecode($input)
    {
        return base64_decode(strtr($input, '-_', '+/'));
    }

    private function decodeBase64($data)
    {
        $data = base64_decode($data);
        return $data;
    }

    private function mac256($ent, $key)
    {
{'fraction_non_alphanumeric': 0.29634898055950687, 'fraction_numerical': 0.015647226173541962, 'mean_word_length': 1.2216956292785677, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2088444', 'n_tokens_mistral': 1203, 'n_tokens_neox': 1120, 'n_words': 217}