Huge news!Announcing our $20M Series A led by Andreessen Horowitz.Learn more
Socket
Socket
Log inDemoInstall

4d63.com/randstr

Package Overview
Dependencies
0
Maintainers
0
Issues
File Explorer

4d63.com/randstr

    v0.0.0-20210416044723-c971ce24631f

Version published
Maintainers
0

Readme

randstr

Linux/OSX Build Status Windows Build Status Go Report Card Go docs

Randstr is a package and a CLI that generates random strings (e.g. passwords), supporting unicode and emojis.

Install

Mac

brew install 4d63/randstr/randstr

Linux/Mac

curl -o /usr/local/bin/randstr https://raw.githubusercontent.com/leighmcculloch/randstr/binaries/$(uname -s | tr '[:upper:]' '[:lower:]')/amd64/randstr && chmod +x /usr/local/bin/randstr

Windows

Download the executable, and save it in your path.

Source

go install 4d63.com/randstr/cmd/randstr

Usage

$ randstr
Ne*!Z|us'VRu;waO53_g{%*gwbY,vY\nw\wR/"5^cg1JkJ`k`l

On Mac, you can pipe the output directly to the clipboard with:

$ randstr | pbcopy

Change the charset:

$ randstr -charset ASCII
NKpZTyBWA;nq3!Lo9qE0OtUC#-Q{UR{I8W"CJFO2u\zam!Nt6c
$ randstr -charset ASCIIUppercase,ASCIINumeric
A9B6VPQG7S3Y0B8QAU16GJGQ2X8HGV24JWOP3NEO84Q7QM416S
$ randstr -charset UnicodeEmoji -l 10
🔙🐨👲🐌🙎🌀👹👾🌺👣
$ randstr -chars 0123456789abcdef
fb972ac28f98ae872a1f42ec707d2f7e0061e22f45e9703275
$ randstr -charset ASCII,UnicodePassword
ʵƦƅȿͺɄϬɚYʩʜLJ͢ȠίϾϺ–Ą̑ȬˁȞ̈́Ȫˑdžȿˀϡʪͻ'ɕ̉ȷNjɃȨƱϷυ[ʦ–Ζϗˆ̮

Package

Use the package by go getting and importing:

go get 4d63.com/randstr/...
import (
  "crypto/rand"
  "4d63.com/randstr/lib/randstr"
  "4d63.com/randstr/lib/charset"
)

func main() {
  password, err := randstr.String(rand.Reader, charset.ASCII, 50)
  if err != nil {
    fmt.Printf("Error: %v\n", err)
    return
  }
  fmt.Printf("Password: %s\n", password)
}

FAQs

Last updated on 16 Apr 2021

Did you know?

Socket installs a GitHub app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the dependencies.

Install
SocketSocket SOC 2 Logo

Product

  • Package Issues
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc