简体   繁体   English

在postgres中加密密码转换

[英]Hashed password conversion in postgres

I am converting oracle stored passwords to postgres. 我将oracle存储的密码转换为postgres。 We stored password in oracle as follows. 我们将密码存储在oracle中,如下所示。

ltrim( to_char( dbms_utility.get_hash_value( upper(name)||'/'||upper(password), 05736, power(2,20) ),rpad( 'X',43,'X')||'X' ) ) 

if i write name and password as ' jhon ' it returns hash value ' 42B21 '. 如果我写名和密码为“ 约翰 ”返回散列值“42B21”。 I need alternative for the same kind of functionality in postgres. 我需要在postgres中使用相同功能的替代方法。 Appreciate your help! 感谢您的帮助!

If password_encryption is md5 , you can calculate the encoded password as 如果password_encryptionmd5 ,则可以将编码后的密码计算为

'md5' || md5(password || username)

With scram-sha-256 , it is much more complicated. 使用scram-sha-256 ,它要复杂得多。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM