FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Enhance crypto/hash.js coverage by Leko · Pull Request #17447 · nodejs/node · GitHub

/ node Public

Enhance crypto/hash.js coverage - #17447

Closed
Leko wants to merge 7 commits into
nodejs:masterfrom
Leko:add_missing_test_in_crypto_Hash_Hmac
Closed

Enhance crypto/hash.js coverage#17447
Leko wants to merge 7 commits into
nodejs:masterfrom
Leko:add_missing_test_in_crypto_Hash_Hmac

Conversation

Leko commented Dec 4, 2017

Copy link
Copy Markdown
Contributor

Added these case

crypto.Hash
  • Call constructor without new keyword
crypto.Hmac
  • Call constructor without new keyword
  • Call constructor with typeof hmac != string
  • Call constructor with typeof hmac = string, typeof key != string

Current coverage is here: https://coverage.nodejs.org/coverage-06e1b0386196f8f8/root/internal/crypto/hash.js.html

I cannot write test case: this._handle.update returns false in Hash#verify.
Because I don't know how to make mdctx_ to nullptr in Hash::HashUpdate.
See also:

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines
Affected core subsystem(s)

test

nodejs-github-bot added the test Issues and PRs related to the tests. label Dec 4, 2017
Leko changed the title Add missing test in crypto hash hmac Enhance crypto/hash.js coverage Dec 4, 2017
mscdex added the crypto Issues and PRs related to the crypto subsystem. label Dec 4, 2017

lpinca commented Dec 4, 2017

Copy link
Copy Markdown
Member

apapirovski left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

LGTM but two small changes needed before this lands

{
const Hash = crypto.Hash;
const instance = crypto.Hash('sha256');
assert(instance instanceof Hash, 'Hash is expected to return a new instance' +

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

needs a space either at the end of this line (after instance) or on the next line. Right now it says "instancewhen".

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Ah, Sorry. I'll update it soon.

{
const Hmac = crypto.Hmac;
const instance = crypto.Hmac('sha256', 'Node');
assert(instance instanceof Hmac, 'Hmac is expected to return a new instance' +

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Same as above.

Right now it says "instance when".

mhdawson left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

LGTM once changes from @apapirovski are incorporated

Copy link
Copy Markdown
Contributor

Same deal as #17458 (comment), are we able to use the create functions here?

maclover7 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Two quick nits, then LGTM


{
const Hmac = crypto.Hmac;
const instance = crypto.Hmac('sha256', 'Node');

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

createHmac


{
const Hash = crypto.Hash;
const instance = crypto.Hash('sha256');

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

createHash

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Same adobe #17458 (comment)

BridgeAR left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

LGTM with @apapirovski comments addressed

Copy link
Copy Markdown
Contributor

Copy link
Copy Markdown
Contributor

@apapirovski Can you confirm your comments were addressed?

Copy link
Copy Markdown
Contributor

Yes and I'm currently landing this

Copy link
Copy Markdown
Contributor

Landed in 3d64533

Thanks @Leko! 👍

apapirovski closed this Dec 7, 2017
apapirovski pushed a commit that referenced this pull request Dec 7, 2017
crypto.Hash
- Call constructor without new keyword

crypto.Hmac
- Call constructor without new keyword
- Call constructor with typeof hmac != string
- Call constructor with typeof hmac = string, typeof key != string

PR-URL: #17447
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Jon Moss <me@jonathanmoss.me>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
MylesBorins pushed a commit that referenced this pull request Dec 12, 2017
crypto.Hash
- Call constructor without new keyword

crypto.Hmac
- Call constructor without new keyword
- Call constructor with typeof hmac != string
- Call constructor with typeof hmac = string, typeof key != string

PR-URL: #17447
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Jon Moss <me@jonathanmoss.me>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
MylesBorins pushed a commit that referenced this pull request Dec 12, 2017
crypto.Hash
- Call constructor without new keyword

crypto.Hmac
- Call constructor without new keyword
- Call constructor with typeof hmac != string
- Call constructor with typeof hmac = string, typeof key != string

PR-URL: #17447
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Jon Moss <me@jonathanmoss.me>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
MylesBorins mentioned this pull request Dec 12, 2017
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

crypto Issues and PRs related to the crypto subsystem. test Issues and PRs related to the tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants


Back | FazBrowse Home | New Git URL