Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The hex value of SHA1 returned by CRT is of size 32 and not 40 #581

Open
trivikr opened this issue Sep 23, 2024 · 0 comments
Open

The hex value of SHA1 returned by CRT is of size 32 and not 40 #581

trivikr opened this issue Sep 23, 2024 · 0 comments
Assignees
Labels
bug This issue is a bug. p2 This is a standard priority issue

Comments

@trivikr
Copy link
Member

trivikr commented Sep 23, 2024

Describe the bug

The hex value of SHA1 returned by CRT is of size 32 and not 40

Expected Behavior

The hex value of sha1 for "hello world" should be "2aae6c35c94fcfb415dbe95f408b9ce91ee846ed"

Current Behavior

The hex value of sha1 for "hello world" is "2aae6c35c94fcfb415dbe95f408b9"

Reproduction Steps

// test.mjs
import { crypto } from "aws-crt";
import { createHash } from "node:crypto";

const data = "hello world";

// Logs '2aae6c35c94fcfb415dbe95f408b9ce91ee846ed'
console.log(createHash("sha1").update(data).digest("hex"));

// Logs '2aae6c35c94fcfb415dbe95f408b9ce9'
console.log(Buffer.from(crypto.hash_sha1(data).buffer).toString("hex"));

Possible Solution

No response

Additional Information/Context

No response

aws-crt-nodejs version used

1.22.0

nodejs version used

20.17.0

Operating System and version

macOS 14.6.1 (23G93)

@trivikr trivikr added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Sep 23, 2024
@jmklix jmklix added p2 This is a standard priority issue and removed needs-triage This issue or PR still needs to be triaged. labels Sep 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. p2 This is a standard priority issue
Projects
None yet
Development

No branches or pull requests

3 participants