All Projects → teris-io → Shortid

teris-io / Shortid

Licence: mit
Super short, fully unique, non-sequential and URL friendly Ids

Programming Languages

go
31211 projects - #10 most used programming language

Labels

Projects that are alternatives of or similar to Shortid

harsh
Hashids implementation in Rust
Stars: ✭ 48 (-92.69%)
Mutual labels:  ids
gonids
gonids is a library to parse IDS rules, with a focus primarily on Suricata rule compatibility. There is a discussion forum available that you can join on Google Groups: https://groups.google.com/forum/#!topic/gonids/
Stars: ✭ 140 (-78.69%)
Mutual labels:  ids
Wazuh Ruleset
Wazuh - Ruleset
Stars: ✭ 305 (-53.58%)
Mutual labels:  ids
TheBriarPatch
An extremely crude, lightweight Web Frontend for Suricata/Bro to be used with BriarIDS
Stars: ✭ 21 (-96.8%)
Mutual labels:  ids
NIDS-Intrusion-Detection
Simple Implementation of Network Intrusion Detection System. KddCup'99 Data set is used for this project. kdd_cup_10_percent is used for training test. correct set is used for test. PCA is used for dimension reduction. SVM and KNN supervised algorithms are the classification algorithms of project. Accuracy : %83.5 For SVM , %80 For KNN
Stars: ✭ 45 (-93.15%)
Mutual labels:  ids
bsmtrace
BSM based intrusion detection system
Stars: ✭ 31 (-95.28%)
Mutual labels:  ids
IPRadar2
Real-time detection and defense against malicious network activity and policy violations (exploits, port-scanners, advertising, telemetry, state surveillance, etc.)
Stars: ✭ 20 (-96.96%)
Mutual labels:  ids
Suricata Rules
Suricata IDS rules 用来检测红队渗透/恶意行为等,支持检测CobaltStrike/MSF/Empire/DNS隧道/Weevely/菜刀/冰蝎/挖矿/反弹shell/ICMP隧道等
Stars: ✭ 397 (-39.57%)
Mutual labels:  ids
Remote-Integrity-Tool
The DearBytes remote integrity tool is an IDS (Intrusion Detection System) that keeps track of files on a remote server and logs an event if a file gets added, removed or modified.
Stars: ✭ 12 (-98.17%)
Mutual labels:  ids
Hashids.js
A small JavaScript library to generate YouTube-like ids from numbers.
Stars: ✭ 3,525 (+436.53%)
Mutual labels:  ids
ids
高效的分布式id生成器,每个客户端实例tps可达到100万,服务端毫无压力。即使服务端宕机了,id生成依然可用。支持多数据中心,支持id加密。
Stars: ✭ 47 (-92.85%)
Mutual labels:  ids
docker-zeek
Zeek IDS Dockerfile
Stars: ✭ 82 (-87.52%)
Mutual labels:  ids
Security Onion
Security Onion 16.04 - Linux distro for threat hunting, enterprise security monitoring, and log management
Stars: ✭ 2,956 (+349.92%)
Mutual labels:  ids
ProbeManager
Centralize Management of Intrusion Detection System like Suricata Bro Ossec ...
Stars: ✭ 73 (-88.89%)
Mutual labels:  ids
Sigma
Generic Signature Format for SIEM Systems
Stars: ✭ 4,418 (+572.45%)
Mutual labels:  ids
Fragscapy
Fragscapy is a command-line tool to fuzz network protocols by automating the modification of outgoing network packets. It can run multiple successive tests to determine which options can be used to evade firewalls and IDS.
Stars: ✭ 52 (-92.09%)
Mutual labels:  ids
docker-suricata
A Suricata Docker image.
Stars: ✭ 120 (-81.74%)
Mutual labels:  ids
Hashids
A small PHP library to generate YouTube-like ids from numbers. Use it when you don't want to expose your database ids to the user.
Stars: ✭ 4,596 (+599.54%)
Mutual labels:  ids
Awesome Cybersecurity Datasets
A curated list of amazingly awesome Cybersecurity datasets
Stars: ✭ 380 (-42.16%)
Mutual labels:  ids
Evebox
Web Based Event Viewer (GUI) for Suricata EVE Events in Elastic Search
Stars: ✭ 286 (-56.47%)
Mutual labels:  ids

Build status Coverage GoReportCard API documentation

Generator of unique non-sequential short Ids

The package shortidenables the generation of short, fully unique, non-sequential and by default URL friendly Ids at a rate of hundreds of thousand per second. It guarantees uniqueness during the time period until 2050!

The package is heavily inspired by the node.js shortid library (see more detail below).

The easiest way to start generating Ids is:

fmt.Printf(shortid.Generate())
fmt.Printf(shortid.Generate())

The recommended one is to initialise and reuse a generator specific to a given worker:

sid, err := shortid.New(1, shortid.DefaultABC, 2342)

// then either:
fmt.Printf(sid.Generate())
fmt.Printf(sid.Generate())

// or:
shortid.SetDefault(sid)
// followed by:
fmt.Printf(shortid.Generate())
fmt.Printf(shortid.Generate())

Id Length

The standard Id length is 9 symbols when generated at a rate of 1 Id per millisecond, occasionally it reaches 11 (at the rate of a few thousand Ids per millisecond) and very-very rarely it can go beyond that during continuous generation at full throttle on high-performant hardware. A test generating 500k Ids at full throttle on conventional hardware generated the following Ids at the head and the tail (length > 9 is expected for this test):

-NDveu-9Q
iNove6iQ9J
NVDve6-9Q
VVDvc6i99J
NVovc6-QQy
VVoveui9QC
...
tFmGc6iQQs
KpTvcui99k
KFTGcuiQ9p
KFmGeu-Q9O
tFTvcu-QQt
tpTveu-99u

Life span

The package guarantees the generation of unique Ids with no collisions for 34 years (1/1/2016-1/1/2050) using the same worker Id within a single (although can be concurrent) application provided application restarts take longer than 1 millisecond. The package supports up to 32 workers all providing unique sequences from each other.

Implementation details

Although heavily inspired by the node.js shortid library this is not just a Go port. This implementation

  • is safe to concurrency (test included);
  • does not require any yearly version/epoch resets (test included);
  • provides stable Id size over a the whole range of operation at the rate of 1ms (test included);
  • guarantees no collisions: due to guaranteed fixed size of Ids between milliseconds and because multiple requests within the same ms lead to longer Ids with the prefix unique to the ms (tests included);
  • supports 32 instead of 16 workers (test included)

The algorithm uses less randomness than the original node.js implementation, which permits to extend the life span as well as reduce and guarantee the length. In general terms, each Id has the following 3 pieces of information encoded: the millisecond since epoch (first 8 symbols, epoch: 1/1/2016), the worker Id (9th symbol), the running concurrent counter within the millisecond (only if required, spanning over all remaining symbols).

The element of randomness per symbol is 1/2 for the worker and the millisecond data and 0 for the counter. The original algorithm of the node.js library uses 1/4 throughout. Here 0 means no randomness, i.e. every value is encoded using a 64-base alphabet directly; 1/2 means one of two matching symbols of the supplied alphabet is used randomly, 1/4 one of four matching symbols. All methods accepting the parameters that govern the randomness are exported and can be used to directly implement an algorithm with e.g. more randomness, but with longer Ids and shorter life spans.

License and copyright

Copyright (c) 2016. Oleg Sklyar and teris.io. MIT license applies. All rights reserved.

Original algorithm: Copyright (c) 2015 Dylan Greene, contributors. The same MIT license applies. Many thanks to Dylan for putting together the original node.js library, which inspired this "port":

Seed computation: based on The Central Randomizer 1.3. Copyright (c) 1997 Paul Houle ([email protected])

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].