Socket
Book a DemoInstallSign in
Socket

uint39

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

uint39

39-bit UInts for Bitcoin BIP-65 scripting

1.0.0
latest
Source
npmnpm
Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

UInt39

Javascript library to read and write 39-bit unsigned integer buffers, useful when working with Bitcoin BIP-65 scripts.

Usage

const UInt39 = require('uint39')
const one = UInt39.fromBigInt(BigInt(1))
const max = UInt39.fromNumber(Math.pow(2, 39) - 1)

one.sizeOptimized() // returns Buffer { 0x01 }
one.toBuffer() // returns Buffer { 0x00 0x00 0x00 0x00 0x01 }
max.sizeOptimized() // returns Buffer { 0x7f 0xff 0xff 0xff 0xff }

const reverse = UInt39.fromBuffer(Buffer.from('1337', 'hex'))
reverse.toNumber() // returns 4919

FAQs

Package last updated on 17 May 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.