- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我在测试登录时得到了一个奇怪的结果。当我使用密码“100percent”时,显示以下输出
ltu1GUwy71wHk = ltu1GUwy71wHk
如果我使用密码 100percenttest
,我会得到相同的输出。
两个不同的密码如何得出相同的结果?
//Get login Details
$username = mysql_real_escape_string($_GET['username']);
$password = mysql_real_escape_string($_GET['password']);
$deviceID = mysql_real_escape_string($_GET['deviceID']);
$model = mysql_real_escape_string($_GET['model']);
$platform = mysql_real_escape_string($_GET['platform']);
$version = mysql_real_escape_string($_GET['version']);
$password = crypt($password, "MYSALT");
//Check login details
$loginQuery = "SELECT * FROM tblMember WHERE Username='$username'";
$loginResult = mysql_query($loginQuery);
$loggedIn = false;
$result = array();
while($row = mysql_fetch_array($loginResult))
{
echo $row['Password'] . "=" . $password . "<BR/>";
最佳答案
来自documentation :
The standard DES-based crypt() returns the salt as the first two characters of the output. It also only uses the first eight characters of str, so longer strings that start with the same eight characters will generate the same result (when the same salt is used).
您可以在 salt 前加上特定的字符串以强制 PHP 使用不同的算法(例如,$5$
以使用 SHA-256)。我个人建议在高回合数时使用 Blowfish;有关示例,请参阅文档。
附言- 你永远不应该在你的 PHP 代码中使用 mysql
。请改用改进的 mysqli
扩展。
关于PHP 密码 crypt 给出奇怪的结果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18051589/
我正在将一些 C 代码从 Linux 迁移到 Mac OSX (yosemite)。 Mac OSX crypt() 函数(在 unistd.h 中,正如我所确定的)与 Linux 中的 gcc/gn
我确实对 crypt() PHP 函数感到困惑。 当第二个 crypt 显然使用不同的第二个参数时,以下两个 crypt 函数如何给出相同的输出?差异盐意味着差异哈希对吗? echo crypt("p
我正在为 CS50 做第 2 周的 pset。 使用 crypt 函数时,指向任何字符串密文的 char 指针总是指向我加密的最后一个东西。 例如: char password[] = "AAAA";
我已经使用 c 中的 crypt 函数来加密给定的字符串。我写了下面的代码, #include #include int main() { printf("%s\n",crypt("passw
我正在比较 PHP 的 crypt() 与 Python 的 crypt()。来自阅读 Python 手册: http://docs.python.org/2/library/crypt.html P
我正在比较 PHP 的 crypt() 与 Python 的 crypt()。来自阅读 Python 手册: http://docs.python.org/2/library/crypt.html P
出于某种原因,无论我尝试什么,使用crypt模块都会使用13字符哈希而不是sha-512。我见过无数关于问题的问题,但没有一个符合我的。难道就没有办法改变 crypt 方法吗? >>> import
我想用 crypt 散列密码使用 blowfish 加密的模块。 在 Fedora 29 上我得到了正确的结果: $ python3.7 Python 3.7.2 (default, Jan 3 2
我目前正在研究 Violent Python 一书中的一个示例。你可以看到我的实现 here 我现在正尝试在 Go 中实现相同的脚本来比较性能,注意我是 Go 的新手。打开文件并遍历这些行很好,但是我
背景 crypt 有两个定义,from the docs, 其中一个使用 unistd.h #define _XOPEN_SOURCE /* See feature_test_macros
我使用 dovecot 作为我的邮件传输代理,我的目标是使用 strongest password scheme我的系统支持:SHA512-CRYPT 或 SHA256-CRYPT(BLF-CRYPT
我正在学习 Python。我不明白为什么 hashlib.sha512(salt + password).hexdigest() 没有给出预期的结果。 我正在寻找与 Ulrich Drepper 的
我正在使用 GCC 4.6.0(在一个其他身份不明的平台上)。 我正在使用 crypt() 函数来加密密码。 我以前从未使用过该功能,所以我查看了主页: man 3 crypt 它说要包含 unist
我正在为 Linux 上的 MD5 哈希方案编写一个基本的密码破解程序 /etc/shadow file 。当我使用commons.codec时的DigestUtils或Crypt库,它们的哈希长度是
我更喜欢在 php 中使用 crypt 函数来进行密码加密和其他单向加密要求。因为我可以使用任何受支持的加密算法,通过更改 salt 并且几乎没有其他优势。通常,我不使用任何盐,它使用随机的 MD5
我有点困惑。当我用盐和密码调用 crypt 时,返回的字符串称为哈希或摘要?我很困惑,因为我知道从加密函数返回的内容称为哈希。但是当我们调用crypt 我们也传递 salt 作为参数。我们可以这样说:
本文整理了Java中freenet.crypt.Yarrow类的一些代码示例,展示了Yarrow类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些
我正在做一个练习,其中我需要将字符串中的字母替换为另一个字母(字母表中它前面的第四个字母)。我还必须消除除空格之外的所有非字母字符(“”)。到目前为止,我能够完成第一步(消除字符),但我无法替换字母。
我正在为我的网站创建我的更改密码网站,我的代码有一些问题...... 出于某种原因,我很难在加密后在数据库中比较和替换密码。 我想要这个: 获取当前用户密码并将其与 $oldpass 的输入值进行比较
当我使用 MD5 时,我曾经在数据库中创建一个 varchar(32) 列。但是,我开始使用 crypt(),据我所知,输出长度是可变的。那么我应该为 varchar 设置哪个长度? 最佳答案 返回的
我是一名优秀的程序员,十分优秀!