Postgresql hmac-sha1签名不同于python签名

Postgresql hmac-sha1签名不同于python签名,python,postgresql,amazon-s3,plpgsql,hmac,Python,Postgresql,Amazon S3,Plpgsql,Hmac,博士后: 代码: 结果:“h9wRL15mXgwRxXjqLqhbYbnfJ7I=“ Python 3 代码: 结果:“CrU1V93ggf3QE0ovq686ir/i1ss=\n” 我想在postgres中签署s3上传请求,但我无法获得正确的签名,我已经尝试了一整天 有人能帮我吗???非常感谢。您正在交换Python中的前两个hmac参数。hmac构造函数首先获取秘密 >>> base64.encodestring( ... hmac.new( ...

博士后

代码:

结果:
“h9wRL15mXgwRxXjqLqhbYbnfJ7I=“

Python 3

代码:

结果:
“CrU1V93ggf3QE0ovq686ir/i1ss=\n”

我想在postgres中签署s3上传请求,但我无法获得正确的签名,我已经尝试了一整天


有人能帮我吗???非常感谢。

您正在交换Python中的前两个
hmac
参数。
hmac
构造函数首先获取秘密

>>> base64.encodestring(
...     hmac.new(
...         '1sf235123'.encode(),
...         'PUT\n\n1\n1408355972\nx-amz-acl:bucket-owner-full-control\n/1/1'.encode(),
...         sha1
...     ).digest()
... )
b'h9wRL15mXgwRxXjqLqhbYbnfJ7I=\n'

谢谢,我考虑不周。
base64.encodestring(
    hmac.new(
        'PUT\n\n1\n1408355972\nx-amz-acl:bucket-owner-full-control\n/1/1'.encode(),
        '1sf235123'.encode(),
        sha1
    ).digest()
)
>>> base64.encodestring(
...     hmac.new(
...         '1sf235123'.encode(),
...         'PUT\n\n1\n1408355972\nx-amz-acl:bucket-owner-full-control\n/1/1'.encode(),
...         sha1
...     ).digest()
... )
b'h9wRL15mXgwRxXjqLqhbYbnfJ7I=\n'