Sha1 in CodeIgniter?

What is the difference between CodeIgniter sha1 and regular PHP sha1? For instance:

$codeigniter_hashed = $this -> encrypt -> sha1( "test" );

and

$normal_hashed = sha1("test");

Both will return the same value. Where encryption_keydoes CodeIgniter use ?

+3
source share
3 answers

If your PHP installation does not have sha1 installed, you can use the CI version. If your PHP installation already has it, you do not need to use the CI function.

From the user manual:

$ this-> encrypt-> SHA1 ()

Encoding Function SHA1. Provide a string and it will return a 160 bit one-way hash. Note: SHA1, like MD5, is not decoded. Example:$hash = $this->encrypt->sha1('Some string');

Many PHP installations have SHA1 support by default, so if all you need to do is encode the hash, it’s easier to use the built-in function: $hash = sha1('Some string');

SHA1 .

: http://codeigniter.com/user_guide/libraries/encryption.html

+6

, , , SHA- - , / , ( ) .

$encrypted_with_encryption_key = $this->encrypt->encode($var);

$encrypted_with_sha_no_enc_key = $this->encrypt->sha1($var);
0

encryption key is stored in config / config.php

$config['encryption_key'] = 'some key';
0
source