Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
github.com/google/triemap
Map using []rune
or []byte
instead of string
Disclaimer: This is not an official Google product.
RuneSliceMap
is much faster than casting and using a map like: map[string(slice)]
.ByteSliceMap
is considerably slower than standard maps, but it reduces allocations.var m triemap.RuneSliceMap
m.PutString("foo", 123)
m.Put([]rune{'b', 'a', 'r'}, 456)
v, ok := m.Get([]rune{'f', 'o', 'o'})
fmt.Println(v, ok) // 123, true
v, ok = m.GetString("bar")
fmt.Println(v, ok) // 456, true
v, ok = m.GetString("baz")
fmt.Println(v, ok) // nil, baz
name time/op
GetByteMap20/ByteMap-16 1.82µs ± 0%
GetByteMap20/StdMap-16 883ns ±14%
GetRuneMap20/RuneMap-16 639ns ± 0%
GetRuneMap20/StdMap-16 1.45µs ± 5%
PutByteMap20/ByteMap-16 2.13µs ± 2%
PutByteMap20/StdMap-16 579ns ± 6%
PutRuneMap20/RuneMap-16 1.09µs ± 5%
PutRuneMap20/StdMap-16 1.26µs ± 4%
name alloc/op
GetByteMap20/ByteMap-16 0.00B
GetByteMap20/StdMap-16 320B ± 0%
GetRuneMap20/RuneMap-16 0.00B
GetRuneMap20/StdMap-16 320B ± 0%
PutByteMap20/ByteMap-16 320B ± 0%
PutByteMap20/StdMap-16 128B ± 0%
PutRuneMap20/RuneMap-16 320B ± 0%
PutRuneMap20/StdMap-16 208B ± 0%
name allocs/op
GetByteMap20/ByteMap-16 0.00
GetByteMap20/StdMap-16 20.0 ± 0%
GetRuneMap20/RuneMap-16 0.00
GetRuneMap20/StdMap-16 20.0 ± 0%
PutByteMap20/ByteMap-16 20.0 ± 0%
PutByteMap20/StdMap-16 19.0 ± 0%
PutRuneMap20/RuneMap-16 20.0 ± 0%
PutRuneMap20/StdMap-16 20.0 ± 0%
Read our contributions doc.
tl;dr: Get Google's CLA and send a PR!
FAQs
Unknown package
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
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.