<?php

/*
 * Copyright (c) 2018 Earworks.
 * Codeigniter Project Template Modification
 * Please contact our email for more information :
 * contact@earworks.co.id
 */

defined('BASEPATH') OR exit('No direct script access allowed');

if (!function_exists('init_hash')) {

    function init_hash() {
        $CI = & get_instance();
        $CI->load->library('encryption');
        $CI->encryption->initialize(array(
            'cipher' => 'rijndael-128',
            'driver' => 'mcrypt',
            'mode' => 'cbc',
        ));
        return $CI;
    }

}
if (!function_exists('hash_data')) {

    function hash_data($raw = null) {
        $CI = init_hash();
        return $CI->encryption->encrypt($raw);
    }

}
if (!function_exists('read_data')) {

    function read_data($hash = null) {
        $CI = init_hash();
        return $CI->encryption->decrypt($hash);
    }

}