gpt4 book ai didi

php - 使用 blowfish 加密验证 MySQL

转载 作者:行者123 更新时间:2023-11-29 03:43:38 29 4
gpt4 key购买 nike

我将我的用户名和密码存储在一个带有 blowfish 加密的 mysql 数据库中。在 php 中,我可以像这样加密密码:

crypt($pwd, _SALT_)

哪里$pwd = 'userpwd'_SALT_ = $2a$07...

我正在寻找一种在 VirtualHost 中使用用户表的方法 mod_auth_mysql .我知道 md5 可以使用 Auth_MySQL_Encryption_Types PHP_MD5但我宁愿留在河豚。

如何告诉 mysql_auth 使用河豚?我在哪里输入盐?

编辑:

这里的基本问题是我必须在虚拟主机文件中的关键字之间使用“_”。所以它看起来像:

<Location /webdav>
AuthType Basic
AuthName "jst-development"
AuthUserFile /dev/null
AuthBasicAuthoritative Off
Auth_MySQL on
Auth_MySQL_Authoritative on
Auth_MySQL_DB user
Auth_MySQL_User user
...

而不是[取自http://modauthmysql.sourceforge.net/CONFIGURE ]

AuthMySQLDB authdata
AuthMySQLUserTable user_info
AuthMySQLGroupField user_group

阻止 apache 提示语法。谁能告诉我为什么或告诉我 AuthMySQLSaltField <> 的“_”语法

//编辑 2:版本:libapache2-mod-auth-mysql (4.3.9-13ubuntu1)

//编辑 3:服务器版本:Apache/2.2.14 (Ubuntu)使用不带“_”的“官方语法”时的确切错误:无效命令“AuthMySQLDB”,可能拼写错误或由未包含在服务器配置中的模块定义

最佳答案

使用

AuthMySQLPwEncryption crypt

http://modauthmysql.sourceforge.net/CONFIGURE

AuthMySQLPwEncryption none | crypt | scrambled | md5 | aes | sha1
The encryption type used for the passwords in AuthMySQLPasswordField:
none: not encrypted (plain text)
crypt: UNIX crypt() encryption
scrambled: MySQL PASSWORD encryption
md5: MD5 hashing
aes: Advanced Encryption Standard (AES) encryption
sha1: Secure Hash Algorihm (SHA1)

WARNING: When using aes encryption, the password field MUST be a BLOB type
(i.e. TINYBLOB). MySQL will strip trailing x'20' characters (blanks), EVEN
IF THE COLUMN TYPE IS BINARY!

AuthMySQLSaltField <> | <string> | mysql_column_name

Contains information on the salt field to be used for crypt and aes
encryption methods. It can contain one of the following:
<>: password itself is the salt field (use with crypt() only)
<string>: "string" as the salt field
mysql_column_name: the salt is take from the mysql_column_name field in the
same row as the password

This field is required for aes encryption, optional for crypt encryption.
It is ignored for all other encryption types.

关于php - 使用 blowfish 加密验证 MySQL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9761642/

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