Skip to content

feat: replace bn.js with bigint wrapper#25

Open
ChALkeR wants to merge 1 commit into
masterfrom
chalker/no-bn/0
Open

feat: replace bn.js with bigint wrapper#25
ChALkeR wants to merge 1 commit into
masterfrom
chalker/no-bn/0

Conversation

@ChALkeR
Copy link
Copy Markdown
Contributor

@ChALkeR ChALkeR commented Nov 5, 2024

bn.js v2 is very old
replace it with a light implementation

Can be migrated to top-level native BigInt later

Let's release the version with bn.js first, and then investigate this

Comment thread lib/crypto/bn.js
class BN {
#value

constructor(number, base, endian) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Do we have this wrapper somewhere else? Maybe in currency? To unify I mean

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.

no
a fully compatible bn.js replacement is not this clean
here, bn.js usage is very limited so it can be replaced

also, this was still using bn.js@2

Comment thread lib/crypto/bn.js
this.#value = BigInt(number)
} else if (typeof number === 'string') {
if (base === 'hex') base = 16
if (base === undefined) base = /[a-f]/.test(number) ? 16 : 10
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.

this is not actually what bn does, recheck

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants