From a41091a680c7b559b49e96f50c3f30dc57a3bb7a Mon Sep 17 00:00:00 2001 From: Pavel Prichodko <14926950+prichodko@users.noreply.github.com> Date: Thu, 9 Jun 2022 19:22:05 +0200 Subject: [PATCH] cleanup generateUsername function --- packages/status-js/src/utils/generate-username.ts | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/packages/status-js/src/utils/generate-username.ts b/packages/status-js/src/utils/generate-username.ts index 202cc52..f522881 100644 --- a/packages/status-js/src/utils/generate-username.ts +++ b/packages/status-js/src/utils/generate-username.ts @@ -1,21 +1,17 @@ const poly = BigInt(0xb8) function lfsr(seed: bigint) { - console.log({ seed }) let bit = 0n for (let index = 0; index < 64; index++) { - const cond = poly & (1n << BigInt(index)) - if (cond !== 0n) { + if ((poly & (1n << BigInt(index))) !== 0n) { bit ^= seed >> BigInt(index) } } - console.log({ bit }) - bit &= 1n - const result = BigInt.asUintN(64, seed << 1n) | bit - return result + + return BigInt.asUintN(64, seed << 1n) | bit } export function generateUsername(publicKey: string): string {