All Projects → railsmechanic → Nanoid

railsmechanic / Nanoid

Licence: mit
Elixir port of NanoID, a secure and URL-friendly unique ID generator. https://hex.pm/packages/nanoid

Programming Languages

elixir
2628 projects

Labels

Projects that are alternatives of or similar to Nanoid

Contract
Source code: https://etherscan.io/address/0x2b591e99afe9f32eaa6214f7b7629768c40eeb39#contracts | All rights are reserved. IT IS NOT LICENSED FOR COPYING. We don't use github for dev.
Stars: ✭ 52 (-62.32%)
Mutual labels:  token
Etherwalletkit
Ethereum Wallet Toolkit for iOS - You can implement an Ethereum wallet without a server and blockchain knowledge.
Stars: ✭ 96 (-30.43%)
Mutual labels:  token
Textrank
😉 🌀 🍓 TextRank implementation in Golang with extendable features (summarization, phrase extraction) and multithreading (goroutine) support (Go 1.8, 1.9, 1.10)
Stars: ✭ 125 (-9.42%)
Mutual labels:  token
Kirby3 Autoid
Automatic unique ID for Pages, Files and Structures including performant helpers to retrieve them. Bonus: Tiny-URL.
Stars: ✭ 58 (-57.97%)
Mutual labels:  token
Go Alone
A simple to use, high-performance, Go (golang) MAC signer.
Stars: ✭ 82 (-40.58%)
Mutual labels:  token
Parsevip
解析VIP资源,解析出酷狗、QQ音乐、腾讯视频、人人视频的真实地址
Stars: ✭ 105 (-23.91%)
Mutual labels:  token
Discord Token Grabber
Gets discord token form ldb files c#
Stars: ✭ 44 (-68.12%)
Mutual labels:  token
Deltabalances.github.io
The Ethereum decentralized exchange assistant. Check token balances, transaction details & trade history.
Stars: ✭ 128 (-7.25%)
Mutual labels:  token
Mana
⏣ Solidity Contracts for the Decentraland MANA Token
Stars: ✭ 91 (-34.06%)
Mutual labels:  token
Laravel Passport Android
Laravel + Passport for an Android App
Stars: ✭ 116 (-15.94%)
Mutual labels:  token
Discord Token Grabber
A simple Discord token grabber written in Python 3
Stars: ✭ 58 (-57.97%)
Mutual labels:  token
Evt
Boost Engine for Token Economy
Stars: ✭ 1,226 (+788.41%)
Mutual labels:  token
Auth Module
auth.nuxtjs.org
Stars: ✭ 1,624 (+1076.81%)
Mutual labels:  token
Bottyclient
A slim Discord client with many cool features including less network traffic which supports bot tokens, but user tokens theoretically work too. Tags: Discord Bot Client Token for Bot Botting Download English
Stars: ✭ 58 (-57.97%)
Mutual labels:  token
Ubi
Universal Basic Income token.
Stars: ✭ 124 (-10.14%)
Mutual labels:  token
Ethereumbook
Mastering Ethereum, by Andreas M. Antonopoulos, Gavin Wood
Stars: ✭ 11,663 (+8351.45%)
Mutual labels:  token
Pytmipe
Python library and client for token manipulations and impersonations for privilege escalation on Windows
Stars: ✭ 104 (-24.64%)
Mutual labels:  token
Ubtokenbar
Flexible and extensible UICollectionView based TokenBar written in Swift
Stars: ✭ 136 (-1.45%)
Mutual labels:  token
Aspnetcorehybridflowwithapi
ASP.NET Core MVC application using API, OpenID Connect Hybrid flow , second API, Code Flow with PKCE
Stars: ✭ 127 (-7.97%)
Mutual labels:  token
Iot Technical Guide
🐝 IoT Technical Guide --- 从零搭建高性能物联网平台及物联网解决方案和Thingsboard源码分析 ✨ ✨ ✨ (IoT Platform, SaaS, MQTT, CoAP, HTTP, Modbus, OPC, WebSocket, 物模型,Protobuf, PostgreSQL, MongoDB, Spring Security, OAuth2, RuleEngine, Kafka, Docker)
Stars: ✭ 2,334 (+1591.3%)
Mutual labels:  token

Nanoid port for Elixir Build Status

Elixir port of NanoID (https://github.com/ai/nanoid), a tiny, secure URL-friendly unique string ID generator.

Safe. It uses cryptographically strong random APIs and tests distribution of symbols.

Compact. It uses a larger alphabet than UUID (A-Za-z0-9_-). So ID size was reduced from 36 to 21 symbols.

Installation

The package can be installed as Hex package:

  1. Add nanoid to your list of dependencies in mix.exs:
def deps do
  [{:nanoid, "~> 2.0.5"}]
end
  1. Run mix deps.get to fetch the package from hex

Introducing a new generator

With version 2.0.0 of nanoid, @ai introduces a new non-secure way of creating NanoIDs. In order to keep this port close to the original, this possibility was also introduced in this port. To ensure a certain level of security, nanoid uses per default the secure token generator. But according to your preferences, if you don't need "cryptographically strong random tokens", just use the non-secure token generator.

Configuration

Starting with version 2.0.0 of nanoid for Elixir it's possible to use config.exs to configure nanoid defaults e.g. for different environments.

config :nanoid,
  size: 21,
  alphabet: "_-0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"

After changing configuration, remember to re-compile nanoid with following command:

$ mix deps.compile nanoid --force

Why re-compile? Continuously reading the configuration via Application.get_env/3 has a significant effect on the speed of nanoid. Compiling the default configuration into byte-code will eliminate the effect.

Usage

Using the "secure" (default) generator

Generate secure NanoIDs of custom size by using the default alphabet

Generate a secure NanoID with the default size of 21 characters.

iex> Nanoid.generate()
"mJUHrGXZBZpNX50x2xkzf"

Generate a secure NanoID with a custom size of 64 characters.

iex> Nanoid.generate(64)
"wk9fsUrhK9k~MxY0hLazRKpcSlic8XYDFusks7Jb8FwCVnoQaKFSPsmmLHzP7qCX"

Generate secure NanoIDs of custom size by using a custom alphabet

Generate a secure NanoID with the default size of 21 characters and an individual alphabet.

iex> Nanoid.generate(21, "abcdef123")
"d1dcd2dee333cae1bfdea"

Generate a secure NanoID with custom size of 64 characters and an individual alphabet.

iex> Nanoid.generate(64, "abcdef123")
"aabbaca3c11accca213babed2bcd1213efb3e3fa1ad23ecbf11c2ffc123f3bbe"

Using the "non-secure" generator

Generate non-secure NanoIDs of custom size by using the default alphabet

Generate a non-secure NanoID with the default size of 21 characters.

iex> Nanoid.generate_non_secure()
"YBctoD1RuZqv0DLfzDxl2"

Generate a non-secure NanoID with a custom size of 64 characters.

iex> Nanoid.generate_non_secure(64)
"D2WBHGWQOVds4YKuErmOGJ-oYfp5rik5Z-qo7kN1Dw3gv_1qQs6POmhqZdabkf8s"

Generate non-secure NanoIDs of custom size and with a custom alphabet

Generate a non-secure NanoID with the default size of 21 characters and an individual alphabet.

iex> Nanoid.generate_non_secure(21, "abcdef123")
"b12c2fac2bdbcdfcfb2da"

Generate a non-secure NanoID with custom size of 64 characters and an individual alphabet.

iex> Nanoid.generate_non_secure(64, "abcdef123")
"dfc1ed3ea22bed1c3c2df2eb21bbd33efdfae3abd3ca2abcca1efcfbf31a3b3f"

License

The MIT License (MIT). Please see License File for more information.

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].