centos 6.8 + postgresql 9.6 + pgcrypto
pgcrypto模块为PostgreSQL提供了密码函数。 简单使用了一下。
创建pgcrypto
mondb=# create extension pgcrypto;
CREATE EXTENSION加密
mondb=# select encrypt('123我men','aa','aes');
              encrypt               
------------------------------------
 \xe5fedda86a06a74d4bbea77c1d372385
(1 row)解密
mondb=# select decrypt('\xe5fedda86a06a74d4bbea77c1d372385','aa','aes');
       decrypt        
----------------------
 \x313233e688916d656e
(1 row)
mondb=# select convert_from(decrypt('\xe5fedda86a06a74d4bbea77c1d372385','aa','aes'),'SQL_ASCII');
 convert_from 
--------------
 123我men
(1 row) 
                    
                
 
                
            
         浙公网安备 33010602011771号
浙公网安备 33010602011771号