所以我试图在 postgresql 中散列一些密码,我为 postgresql 找到的唯一散列解决方案是 pgcrytpo 包的一部分(http://www.postgresql.org/docs/8.3/static/pgcrypto.h)。 html ) 应该在 postgresql-contrib ( http://www.postgresql.org/docs/8.3/static/contrib.html ) 中。
所以我安装了 postgresql-contrib,(sudo apt-get install postgresql-contrib),重新启动了我的服务器(作为重新启动 postgresql 的简单方法)。
但是,我仍然无法访问应该在 postgresql-contrib 中的任何散列函数,例如:
ninjawars=# select crypt('global salt' || 'new password' || 'user created date', gen_salt('sha256'));
ERROR: function gen_salt(unknown) does not exist
ninjawars=# select digest('test', 'sha256') from players limit 1;
ERROR: function digest(unknown, unknown) does not exist
ninjawars=# select hmac('test', 'sha256') from players limit 1;
ERROR: function hmac(unknown, unknown) does not exist
Run Code Online (Sandbox Code Playgroud)
那么如何在 ubuntu 上的 postgresql 中散列密码呢?
这可能是一个提示,来自您上面列出的网页之一:
许多模块提供新的用户定义函数、运算符或类型。要使用这些模块之一,在安装代码后,您需要通过运行模块提供的 .sql 文件中的 SQL 命令在数据库系统中注册新对象。例如,
Run Code Online (Sandbox Code Playgroud)psql -d dbname -f SHAREDIR/contrib/module.sql
| 归档时间: |
|
| 查看次数: |
11660 次 |
| 最近记录: |