Call to undefined method CI_Encrypt::sha1()
<p>I follow a tutorial from youtube <a href="https://www.youtube.com/watch?v=h4DGhtq6dso" rel="nofollow noreferrer">Tutorial codeigniter - Insert</a> but,
Im getting this error inside my controller file for my browser when im using the encryption library from codeigniter 2. 
<br>Error code when using encryption.</p>

<pre><code>$paramUsu['clave'] = $this-&gt;encrypt-&gt;sha1($this-&gt;input-&gt;post('txtClave'));
</code></pre>

<p>But when im just passing it without the encryption it working just fine.<br></p>

<pre><code>$paramUsu['clave'] = $this-&gt;input-&gt;post('txtClave');
</code></pre>

<p>Im getting this error at my browser:</p>

<blockquote>
  <p>Fatal error: Call to undefined method CI_Encrypt::sha1() in C:\xampp\htdocs\TRAINING\tutorialCI\application\controllers\cpersona.php on line 31
  <br>A PHP Error was encountered
  Severity: Error
  <br>Message: Call to undefined method CI_Encrypt::sha1()
  <br>Filename: controllers/cpersona.php
  <br>Line Number: 31
  <br>Backtrace:</p>
</blockquote>

<p>Here is the code for my controller:</p>

<pre><code>&lt;?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Cpersona extends CI_Controller {

    function __construct()
    {
        parent::__construct();
                //call model
                $this-&gt;load-&gt;model('mpersona');
                $this-&gt;load-&gt;model('musuario');
                //call encryption library for password at 'clave' textfield
                $this-&gt;load-&gt;library('encrypt');
    }

    public function index(){
        $this-&gt;load-&gt;view('persona/vpersona');
    }

    public function guardar(){
        //persona
        $param['dni'] = $this-&gt;input-&gt;post('txtDNI');
        $param['nombre'] = $this-&gt;input-&gt;post('txtNombre');
        $param['appaterno'] = $this-&gt;input-&gt;post('txtApPaterno');
        $param['apmaterno'] = $this-&gt;input-&gt;post('txtApMaterno');
        $param['email'] = $this-&gt;input-&gt;post('txtEmail');
        $param['fecnac'] = $this-&gt;input-&gt;post('datFecNac');
        //usuario
        $paramUsu['nomUsuario'] = $this-&gt;input-&gt;post('txtUsuario');
        //$paramUsu['clave'] = $this-&gt;input-&gt;post('txtClave');
        $paramUsu['clave'] = $this-&gt;encrypt-&gt;sha1($this-&gt;input-&gt;post('txtClave'));

        //call function name in model
        //call function variable '$param'
        //$this-&gt;mpersona-&gt;guardar($param);

        $lastId = $this-&gt;mpersona-&gt;guardar($param);

        //check if $lastId is filled in persona table
        if ($lastId &gt; 0){
            $paramUsu['idPersona'] = $lastId;
            //$paramUsu value will be go also in usuario model
            $this-&gt;musuario-&gt;guardarUsuario($paramUsu);
        }
    }
}
</code></pre>