gpt4 book ai didi

Mysql二进制存储问题

转载 作者:行者123 更新时间:2023-11-29 15:04:44 25 4
gpt4 key购买 nike

我使用sha256进行散列并以二进制形式输出,并将其存储在Mysql的BINARY(32)中。

 echo $testsha256 = hash( 'sha256', "aKyAmNsb", true );

但是,当我从数据库检索这个值时,它是不同的

 print_r(str_split($returnedpassword));
echo "<br>";
print_r(str_split($testsha256));
echo "<br>";

数组 ( [0] => ú [1] => È [2] => c [3] => [4] => u [5] => k [6] => ë [7] = > a [8] => Ð [9] => ‰ [10] => V [11] => û [12] => E [13] => [ [14] => [15] => Ø [ 16] => Ý [17] => Q [18] => â [19] => ž [20] => ? [21] => [22] => 3/4 [23] => ¡ [24] = > ÷ [25] => 9 [26] => í [27] => Ž [28] => [29] => 5 [30] => ˆ [31] => )

数组 ( [0] => ú [1] => È [2] => c [3] => [4] => u [5] => k [6] => ë [7] = >\[8] => a [9] => Ð [10] => ‰ [11] => V [12] => û [13] => E [14] => [ [15] => [ 16] => Ø [17] => Ý [18] => Q [19] => â [20] => ž [21] => ? [22] => [23] => 3/4 [24] = > ì [25] => ÷ [26] => 9 [27] => í [28] => Ž [29] => [30] => 5 [31] => ˆ)

如您所见,从 Mysql 返回的二进制文件在索引 8 上的“a”之前缺少“\”。索引 8 应该包含“\”,就像在 $testsha256 中一样,但“\”不是在 $returnedresult 中

最佳答案

使用mysql_real_escape_string将哈希值插入数据库时​​。

关于Mysql二进制存储问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2393785/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com