-
-
Notifications
You must be signed in to change notification settings - Fork 636
updating tests diffie-hellman #2584
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
base: main
Are you sure you want to change the base?
Changes from all commits
c1ab732
ac1da54
d71c63d
dd07216
7bc0075
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
], | ||
"contributors": [ | ||
"ankorGH", | ||
"jagdish-15", | ||
"rchavarria", | ||
"serixscorpio", | ||
"SleeplessByte", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,7 @@ describe('diffie-hellman', () => { | |
}).toThrow(); | ||
}); | ||
|
||
describe('input validation', () => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since our tests include custom cases that are not part of the predefined ones, the structure of our test file in not standard either. As such, the name of this section of test cases is not incorrect, and shouldn't be changed. However, it is missing two of the standard tests, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure! I'll make the changes by checking out other tracks for inspiration. It'll take a bit of time since I need to prepare for a college exam tomorrow, but I'll get to it once the exam is over. Thanks for your understanding! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. best of luck on the exam! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you so much for the kind words, @Cool-Katt! I really appreciate it! Regarding the tests, I realized while implementing them that they check the Would you like me to add the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, that would probably explain why the tests for validating the private key were missing 😅 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure, will get to it as soon as possible! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jagdish-15 how is it going now? Still have time for this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @SleeplessByte, I apologize for the delay—I didn’t intend to hold up the PR. I was occupied with organizing a college club event for CodePVG. I’ll get to work on this right away! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @SleeplessByte and @Cool-Katt, I've made the necessary changes and implemented the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
describe('private key is greater than 1 and less than p', () => { | ||
const p = 23; | ||
const g = 5; | ||
const diffieHellman = new DiffieHellman(p, g); | ||
|
@@ -87,4 +87,25 @@ describe('diffie-hellman', () => { | |
|
||
expect(secretA).toEqual(secretB); | ||
}); | ||
|
||
xtest('private key is greater than 1 and less than p', () => { | ||
let p = 23; | ||
for (let i = 0; i < 10; i++) { | ||
let privateKey = DiffieHellman.getPrivateKey(p); | ||
expect(privateKey).toBeGreaterThan(1); | ||
expect(privateKey).toBeLessThan(p); | ||
} | ||
}); | ||
|
||
xtest('private key is random', () => { | ||
let p = 7919; | ||
let uniqueKeys = new Set(); | ||
let testIterations = 1000; | ||
|
||
for (let i = 0; i < testIterations; i++) { | ||
uniqueKeys.add(DiffieHellman.getPrivateKey(p)); | ||
} | ||
|
||
expect(uniqueKeys.size).toBeGreaterThan(testIterations - 100); | ||
}); | ||
}); |
Uh oh!
There was an error while loading. Please reload this page.