Research
Security News
Threat Actor Exposes Playbook for Exploiting npm to Build Blockchain-Powered Botnets
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
#bitfield
a very simple bitfield, compliant with the Bittorrent spec
npm install bitfield
####Example
var Bitfield = require("bitfield");
var field = new Bitfield(256); //create a bitfield with 256 bits
field.set(128); //set the 128th bit
field.set(128, true); //same as above
field.get(128); //true
field.get(200); //false (all values are initialised to `false`)
field.get(1e3); //false (out-of-bounds is also false)
field.set(128, false); //set the 128th bit to 0 again
field.buffer; //the buffer used by bitfield
####Methods
Bitfield(data)
: data
can be either a node.js buffer, WebGL Int8Array or numeric array, or a number representing the maximum number of supported bytes.
Bitfield#get(index)
: Returns a boolean indicating whether the bit is set.
Bitfield#set(index[, value])
: value
defaults to true. Sets the bit to 1
for a value of true
or 0
for false
.
Bitfield(data, { grow: size })
: If you set
an index that is out-of-bounds, the Bitfield will automatically grow so that the bitfield is big enough to contain the given index, up to the given size
(in bit). If you want the Bitfield to grow indefinitely, pass Infinity
as the size.
####Properties
Bitfield#buffer
: The contents of the bitfield.
Bitfield#grow
: The passed growth option (defaults to 0
).
##License
MIT
FAQs
a simple bitfield, compliant with the BitTorrent spec
The npm package bitfield receives a total of 3,931 weekly downloads. As such, bitfield popularity was classified as popular.
We found that bitfield demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
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.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
Security News
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Security News
Research
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.