Description
Looks like hashbytes is including quotes when computing,
For example, I would expect "Hello World" sha256 hash to be: a591a6d40bf420404a011733cfb7b190d62c65bf0bcda32b57b277d9ad9f146e
>>> hashlib.sha256(b'Hello World').hexdigest() |
'a591a6d40bf420404a011733cfb7b190d62c65bf0bcda32b57b277d9ad9f146e'
|
|
# echo -n 'Hello World' | openssl sha256 |
(stdin)= a591a6d40bf420404a011733cfb7b190d62c65bf0bcda32b57b277d9ad9f146e
|
but it returns diff hash: 07cf55095ef805a89c07bf3d4764b07352a8f4b2cc3df166e89d2193131536bd
cbq> select hashbytes('Hello World', {"algorithm":"sha256"}); |
{
|
"requestID": "789f113c-9fc0-43e8-9f0c-c441c3825ce7", |
"signature": { |
"$1": "string" |
},
|
"results": [ |
{
|
"$1": "07cf55095ef805a89c07bf3d4764b07352a8f4b2cc3df166e89d2193131536bd" |
}
|
After closer look it seems hash above is for '"Hello World"' as shown below:
>>> hashlib.sha256(b'"Hello World"').hexdigest() |
'07cf55095ef805a89c07bf3d4764b07352a8f4b2cc3df166e89d2193131536bd'
|
|
Attachments
Issue Links
- relates to
-
MB-16624 Scalar functions in N1QL for hashing data
- Closed