optimus-go alternatives and similar packages
Based on the "Security" category.
Alternatively, view optimus-go alternatives based on common mentions on social networks and blogs.
-
Lean and Mean Docker containers
Slim(toolkit): Don't change anything in your container image and minify it by up to 30x (and for compiled languages even more) making it secure too! (free and open source) -
age
A simple, modern and secure encryption tool (and Go library) with small explicit keys, no config options, and UNIX-style composability. -
CertMagic
Automatic HTTPS for any Go program: fully-managed TLS certificate issuance and renewal -
Cameradar
Cameradar hacks its way into RTSP videosurveillance cameras -
memguard
Secure software enclave for storage of sensitive information in memory. -
acmetool
:lock: acmetool, an automatic certificate acquisition tool for ACME (Let's Encrypt) -
secure
HTTP middleware for Go that facilitates some quick security wins. -
Themis by Cossack Labs
Easy to use cryptographic framework for data protection: secure messaging with forward secrecy and secure data storage. Has unified APIs across 14 platforms. -
acra
Database security suite. Database proxy with field-level encryption, search through encrypted data, SQL injections prevention, intrusion detection, honeypots. Supports client-side and proxy-side ("transparent") encryption. SQL, NoSQL. -
Coraza
OWASP Coraza WAF is a golang modsecurity compatible web application firewall library -
ToRat
ToRat is a Remote Administation tool written in Go using Tor as a transport mechanism and RPC for communication -
dongle
A simple, semantic and developer-friendly golang package for encoding&decoding and encryption&decryption -
go-password-validator
Validate the Strength of a Password in Go -
firewalld-rest
A rest application to update firewalld rules on a linux server -
passlib
:key: Idiotproof golang password validation library inspired by Python's passlib -
BadActor
BadActor.org An in-memory application driven jailer written in Go -
simple-scrypt
A convenience library for generating, comparing and inspecting password hashes using the scrypt KDF in Go 🔑 -
teler-waf
teler-waf is a Go HTTP middleware that provides teler IDS functionality to protect against web-based attacks. -
argon2pw
Argon2 password hashing package for go with constant time hash comparison -
goSecretBoxPassword
A probably paranoid Golang utility library for securely hashing and encrypting passwords based on the Dropbox method. This implementation uses Blake2b, Scrypt and XSalsa20-Poly1305 (via NaCl SecretBox) to create secure password hashes that are also encrypted using a master passphrase. -
certificates
An opinionated helper for generating tls certificates -
Credman
Simple and secure credential/password management with extra steps in Go! -
secureio
An easy-to-use XChaCha20-encryption wrapper for io.ReadWriteCloser (even lossy UDP) using ECDH key exchange algorithm, ED25519 signatures and Blake3+Poly1305 checksums/message-authentication for Go (golang). Also a multiplexer. -
sslmgr
A layer of abstraction the around acme/autocert certificate manager (Golang) -
goArgonPass
goArgonPass is a Argon2 Password utility package for Go using the crypto library package Argon2 designed to be compatible with Passlib for Python and Argon2 PHP. Argon2 was the winner of the most recent Password Hashing Competition. This is designed for use anywhere password hashing and verification might be needed and is intended to replace implementations using bcrypt or Scrypt. -
argon2-hashing
A light package for generating and comparing password hashing with argon2 in Go -
Go random string generator
Flexible and customizable random string generator
ONLYOFFICE Docs — document collaboration in your environment
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of optimus-go or a related project?
Popular Comparisons
README
ID Obfuscation/Hashing Transformer for Go

There are many times when you want to generate obfuscated ids. This package utilizes Knuth's Hashing Algorithm to transform your internal ids into another number to hide it from the general public.
An example may be your database table. You may have a primary key that points to a particular customer. For security reasons you don't want to expose that id to the outside world. That is exactly where this package becomes handy.
Optimus encodes your internal id to a number that is safe to expose. Finally it can decode that number back so you know which internal id it refers to.
⭐ the project to show your appreciation.
Installation
go get -u github.com/pjebs/optimus-go
Usage
Step 1
- Find or Calculate a PRIME number from somewhere. It must be smaller than
2147483647
(MAXID) - Calculate the Mod Inverse of the Prime number such that
(PRIME * INVERSE) & MAXID == 1
- Generate a Pure Random Integer less than
2147483647
(MAXID).
You can use the built-in generator.GenerateSeed()
function to generate all 3 required parameters if you want.
Step 2
package hello
import (
"fmt"
"github.com/pjebs/optimus-go"
)
o := optimus.New(1580030173, 59260789, 1163945558) // Prime Number: 1580030173, Mod Inverse: 59260789, Pure Random Number: 1163945558
new_id := o.Encode(15) // internal id of 15 being transformed to 1103647397
orig_id := o.Decode(1103647397) // Returns 15 back
Please note that in order for Optimus to transform the id back to the original, all 3 numbers of the constructor must be consistent. You will need to store it somewhere after generation and usage.
Methods
type Optimus struct {
prime uint64
modInverse uint64
random uint64
}
func New(prime uint64, modInverse uint64, random uint64) Optimus
New returns an Optimus struct that can be used to encode and decode integers.
A common use case is for obfuscating internal ids of database primary keys.
It is imperative that you keep a record of prime
, modInverse
and random
so that
you can decode an encoded integer correctly. random
must be an integer less than MAX_INT
.
WARNING: The function panics if prime is not a valid prime. It does a probability-based prime test using the MILLER-RABIN algorithm.
CAUTION: DO NOT DIVULGE prime, modInverse and random!
func NewCalculated(prime uint64, random uint64) Optimus
NewCalculated returns an Optimus struct that can be used to encode and decode integers.
random
must be an integer less than MAX_INT
.
It automatically calculates prime's mod inverse and then calls New.
func (o Optimus) Encode(n uint64) uint64
Encode is used to encode n using Knuth's hashing algorithm.
func (o Optimus) Decode(n uint64) uint64
Decode is used to decode n back to the original. It will only decode correctly if the Optimus struct is consistent with what was used to encode n.
func (o Optimus) Prime() uint64
Prime returns the associated prime.
CAUTION: DO NOT DIVULGE THIS NUMBER!
func (o Optimus) ModInverse() uint64
ModInverse returns the associated mod inverse.
CAUTION: DO NOT DIVULGE THIS NUMBER!
func (o Optimus) Random() uint64
Random returns the associated random integer.
CAUTION: DO NOT DIVULGE THIS NUMBER!
func ModInverse(n int64) uint64
ModInverse returns the modular inverse of a given prime number.
The modular inverse is defined such that (PRIME * MODULAR_INVERSE) & (MAX_INT_VALUE) = 1
.
See: http://en.wikipedia.org/wiki/Modular_multiplicative_inverse
NOTE: prime is assumed to be a valid prime. If prime is outside the bounds of an int64, then the function panics as it can not calculate the mod inverse.
func generator.GenerateSeed() (Optimus, error)
GenerateSeed will generate a valid optimus object which can be used for encoding and decoding values.
See http://godoc.org/github.com/pjebs/optimus-go/generator#GenerateSeed for details on how to use it.
Alternatives
There is the hashids package which is very popular. Out of the box, it produces obfuscated ids that can contain any number of characters.
However:
- Knuth's algorithm is 127 times faster in benchmarks
- Hashids produce strings that contain characters other than just numbers.
- If you were to modify the code (since the default minimum alphabet size is 16 characters) to allow only characters (0-9), it removes the first and last numbers to use as separators.
- If the character '0' by coincidence comes out at the front of the obfuscated id, then you can't convert it to an integer when you store it. An integer will remove the leading zero but you need it to decode the number back to the original id (since hashid deals with strings and not numbers).
Inspiration
This package is based on the PHP library by jenssegers.
Other useful packages
- dataframe-go - Statistics and data manipulation
- dbq - Zero boilerplate database operations for Go
- electron-alert - SweetAlert2 for Electron Applications
- igo - A Go transpiler with cool new syntax such as fordefer (defer for for-loops)
- mysql-go - Properly cancel slow MySQL queries
- react - Build front end applications using Go
- remember-go - Cache slow database queries
Final Notes
Feel free to fork and/or provide pull requests. Any bug reports will be warmly received.
© 2014-20 PJ Engineering and Business Solutions Pty. Ltd.