Skip to content
This repository has been archived by the owner on Apr 15, 2019. It is now read-only.

Syntax and documentation improvements in passphrase utility #1048

Closed
wants to merge 6 commits into from

Conversation

webmaster128
Copy link
Contributor

This is a PR containing the exact same commits from LiskHQ/lisk-desktop#654. Since the files did not change much between nano and hub, no merges were necessary

Simon Warta added 6 commits April 7, 2018 15:58
This code selects a random array index from `available` or `byte`. The
formular for this operation is `Math.floor(Math.random()*items.length)`
(see https://stackoverflow.com/a/5915122).

In the current code, Math.floor is replaced with parseInt, which is
meant to convert a string, not a floating point number. Since parseInt
converts a number to a string first, the result will be the same in most
cases. However, parseInt is not the right tool in this place. MDN
excplicitly warns: "parseInt should not be used as a substitute for
Math.floor()"
(https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/parseInt)
The value of the variable is not the bit (0 or 1) but the index in the
array `byte`.
parseInt(`0x${num}`, 10) is always 0 for any hex string `num`.
Before, an empty array from generateSeed() would make this test pass.
@slaweet
Copy link
Contributor

slaweet commented Apr 9, 2018

Thanks for the PRs @webmaster128
It looks like Jenkins is not passing even on the development branch. https://jenkins.lisk.io/job/lisk-nano/job/development/ and I didn't notice it before as we didn't push any changes to Lisk Nano recently. We'll have to fix the tests before your PRs can be merged.

@webmaster128
Copy link
Contributor Author

@slaweet sure, no problem. Let me know when you fixed development. Then I can rebase my PRs such that everything is nice and clean.

@webmaster128
Copy link
Contributor Author

@slaweet Any updates on Nano's CI health?

@slaweet slaweet changed the base branch from development to 2.0.0 April 17, 2018 09:14
@slaweet slaweet requested a review from reyraa April 17, 2018 11:33
@karmacoma karmacoma removed the request for review from reyraa November 14, 2018 11:31
@karmacoma karmacoma closed this Nov 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants