Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/237.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 编码点火器中的sha1?_Php_Codeigniter_Sha1 - Fatal编程技术网

Php 编码点火器中的sha1?

Php 编码点火器中的sha1?,php,codeigniter,sha1,Php,Codeigniter,Sha1,CodeIgniter sha1和普通PHP sha1有什么区别? 例如: $codeigniter_hashed = $this -> encrypt -> sha1( "test" ); 及 两者都将返回相同的值。 CodeIgniter在哪里使用加密密钥 非常确定您显示的函数是纯SHA加密-如果您想对数据进行加密/编码,则只需使用特定的加密密钥,这样只有您(加密密钥的持有者)才能对其进行解密 $encrypted_with_encryption_key = $this->

CodeIgniter sha1和普通PHP sha1有什么区别? 例如:

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

两者都将返回相同的值。
CodeIgniter在哪里使用
加密密钥

非常确定您显示的函数是纯SHA加密-如果您想对数据进行加密/编码,则只需使用特定的加密密钥,这样只有您(加密密钥的持有者)才能对其进行解密

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

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

如果您的PHP安装没有安装sha1,则可以使用CI版本。如果您的PHP安装已经安装了它,则不需要使用CI函数

从用户指南:

$this->encrypt->sha1(); SHA1编码函数。提供 字符串,它将返回160位 单向散列。注:SHA1,就像 MD5是不可解码的。示例:
$hash=
$this->encrypt->sha1('Some string')

许多PHP安装都有SHA1 默认支持,因此如果您需要 是对散列进行编码更简单 使用本机函数:
$hash=
sha1(“某些字符串”)

如果您的服务器不支持SHA1 您可以使用提供的功能


更多信息:

加密密钥保存在config/config.php 作为

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

$encrypted_with_sha_no_enc_key = $this->encrypt->sha1($var);
$config['encryption_key'] = 'some key';