Skip to content

密码生成规则

boyofmonk@gmail.com edited this page Dec 2, 2019 · 1 revision

密码生成规则

数据库表host_users表结构

ejabberd=# \d host_users
                                   Table "public.host_users"
   Column    |          Type          |                        Modifiers                        
-------------+------------------------+---------------------------------------------------------
 id          | bigint                 | not null default nextval('host_users_id_seq'::regclass)
 host_id     | bigint                 | not null
 user_id     | text                   | not null
 user_name   | text                   | not null
 department  | text                   | not null
 tel         | text                   | 
 email       | text                   | 
 dep1        | text                   | not null
 dep2        | text                   | default ''::text
 dep3        | text                   | default ''::text
 dep4        | text                   | default ''::text
 dep5        | text                   | default ''::text
 pinyin      | text                   | 
 frozen_flag | smallint               | not null default 0
 version     | integer                | not null default 1
 user_type   | character(1)           | default 'U'::bpchar
 hire_flag   | smallint               | not null default 1
 gender      | smallint               | not null default 0
 password    | text                   | 
 initialpwd  | smallint               | not null default 1
 ps_deptid   | text                   | default 'QUNAR'::text
 pwd_salt    | character varying(200) | 
Indexes:
    "host_users_pkey" PRIMARY KEY, btree (id)
    "host_users_user_id_host_id_key" UNIQUE CONSTRAINT, btree (user_id, host_id)
    "host_users_hire_flag_user_name_idx" btree (hire_flag, user_name)
    "host_users_host_id_idx" btree (host_id)
    "host_users_user_id_idx" btree (user_id)
    "host_users_user_name_idx" btree (user_name)
    "host_users_version_idx" btree (version)

password的值是:"CRY:"+md5(md5(md5("密码明文")+pwd_salt))

pwd_salt的值是:uuid()

举例:

明文密码:testpassword
加密后的密码:CRY:fd540f073cc09aa98220bbb234153bd5
pwd_salt:qtalkadmin_pwd_salt_d2bf42081aab47f4ac00697d7dd32993

ejabberd=# select concat ('CRY:', md5(md5(concat(md5('testpassword'), 'qtalkadmin_pwd_salt_d2bf42081aab47f4ac00697d7dd32993'))));
                concat                
--------------------------------------
 CRY:fd540f073cc09aa98220bbb234153bd5
(1 row)