moar comments

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2020-02-06 12:46:40 +01:00
parent 1c8c30c3ae
commit 28c86e7f41
No known key found for this signature in database
GPG Key ID: 4EF064D0E6D63020
2 changed files with 5 additions and 0 deletions

View File

@ -15,6 +15,9 @@ const ONE = BigInt(1)
const UINT64 = BigInt("0xFFFFFFFFFFFFFFFF")
/**
* Linear-Feedback Shift Register algorithm
* For details: https://en.wikipedia.org/wiki/Linear-feedback_shift_register
*
* This implementation is based on the GoLang one in status-go:
* https://github.com/status-im/status-go/tree/develop/protocol/identity/alias
**/

View File

@ -48,8 +48,10 @@ function chatKeyToChatName(pubKeyStr) {
let seed = pubKeyX
let poly = BigInt(184)
/* Linear-Feedback Shift Register */
let gen = new LSFR(poly, seed)
/* Pick words based on modulo of generated number */
let adjec1 = gen.next() % BigInt(adjectives.length)
let adjec2 = gen.next() % BigInt(adjectives.length)
let animal = gen.next() % BigInt(animals.length)