Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
digital_trees_and_sets
Advanced tools
A digital tree is an integer-integer mapping, in function close to the well known Hash. It is a little more restricted than the Hash know to ruby users, but it's functionality is exactly the same as the st_int_table that is used to implement the hash.
A digital tree encodes the key's value in the position of the tree ad thus saves memory compared to other solution.
This gem is a hand coded wrapper around the judy tree (judy.sourceforge.net), written by Doug Baskins with extreme attention to cache lines. It is there quite fast. There is a judy_bench.rb file to experiment with, and results in the wiki.
JudyHash may be used as a direct replacement for Hash when keys are Symbols or Integers.
The JudySet implements a Set, similar to the Set in Judy (again only for integers or Symbols). It is implemented as a true integer - bit mapping.
In other words, the set is not implemented with a Hash, in fact it is more the other way around. A Set is just as fast as a Tree, but much much more space efficient.
Asymptotically, for large sets of keys and specifically very dense keys, the set approaches the efficiency of a bitmap. At the same time the tree approaches an array. But for normal use the Tree takes about as much memory as the key and value together (ie 16 bytes) and the set about 4-3 bytes.
Just install gem with gem install digital_trees_and_sets or ad to Gemfile.
require "digital_trees_and_sets"
tree = JudyHash.new => #JudyHash:0x000001009d5980 1.9.3-p327 :007 > 10000000.times {|i| tree[i] = i } => 10000000 1.9.3-p327 :008 > a.length => 10000000 1.9.3-p327 :009 > a.mem_used => 86269816
ie int or sym as key and and object as value. It would be quite simple to implement the HashWithIndifferent, but that hasn't been the point up to now.
The build system creates a 64 bit version of judy even if you are still on 32 (doubtful). If you patch that, do send a pull.
The functionality and test are not necessarily complete. This is a proof of concept, actually a spinoff of another project. Pulls accepted.
FAQs
Unknown package
We found that digital_trees_and_sets demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.