【问题标题】:Pgcrypto doesn't work correctly on WindowsPgcrypto 在 Windows 上无法正常工作
【发布时间】:2014-11-06 08:41:25
【问题描述】:

我在 2 个不同的服务器上执行相同的查询,得到不同的结果。有谁知道为什么?

select decrypt('\x792135887dace2af15d3f8548cc20919','\x265bb788ef6762abf50577f8a6669aa0','aes-ecb')

Debian postgresql 9.3 服务器输出(预期结果):

"\xafb8967640bd0400309e7b0008acbb23"

Windows postgresql 9.3 服务器输出(结果错误):

"\257\270\226v@\275\004\0000\236{\000\010\254\273#"

【问题讨论】:

  • 我尝试使用相同排序规则的 debian 服务器的另一个数据库,但遇到了同样的问题。

标签: aes postgresql-9.3 pgcrypto


【解决方案1】:

您的 Windows 9.3 服务器具有非默认配置;它将bytea_output 设置为escape 模式,而不是hex 模式。

结果实际上是相同的,只是以底层二进制文件的不同文本表示形式显示。

regress=> SHOW bytea_output;
 bytea_output 
--------------
 hex
(1 row)

regress=> SELECT BYTEA '\257\270\226v@\275\004\0000\236{\000\010\254\273#';
               bytea                
------------------------------------
 \xafb8967640bd0400309e7b0008acbb23
(1 row)

【讨论】:

    猜你喜欢
    • 2020-08-04
    • 2016-04-11
    • 1970-01-01
    • 2019-09-01
    • 2021-01-14
    • 2021-10-30
    • 1970-01-01
    • 2015-01-30
    • 1970-01-01
    相关资源
    最近更新 更多