Coder Social home page Coder Social logo

ramanan-natarajan / shorturl Goto Github PK

View Code? Open in Web Editor NEW

This project forked from delight-im/shorturl

0.0 2.0 0.0 24 KB

Bijective conversion between natural numbers (IDs) and short strings

License: MIT License

C# 7.34% C++ 8.62% Elixir 9.06% Java 7.33% JavaScript 6.70% Lua 7.21% PLpgSQL 9.64% SQLPL 10.44% PHP 7.05% Python 6.13% Ruby 5.97% Scala 6.66% Swift 7.84%

shorturl's Introduction

ShortURL

Bijective conversion between natural numbers (IDs) and short strings

Useful for URL shorteners and short IDs in your permalinks

Usage

  • ShortURL.encode() takes an ID and turns it into a short string
  • ShortURL.decode() takes a short string and turns it into an ID

Features

  • very short strings (much shorter than hex)
    • uses large alphabet of 51 characters
  • URL-safe (in contrast to Base64)
    • doesn't use any characters that need to be encoded for use in URLs
  • protection against offensive words (in contrast to Base64 and hex)
    • vowels are not used
  • unambiguous (in contrast to Base64 and hex)
    • look-alike characters are not used

Example output

  • 3141592 <=> vJST
  • 123456789 <=> pgK8p

Number range

All numbers from 1 to 2,147,483,647 inclusively can be safely encoded and decoded again in all implementations.

Contributing

All contributions are welcome! If you wish to contribute, please create an issue first so that your feature, problem or question can be discussed.

License

This project is licensed under the terms of the MIT License.

shorturl's People

Contributors

11ujjawal avatar bohdanszymanik avatar diatrevolo avatar guilhebl avatar hs0ucy avatar marciuz avatar marzsv avatar nforysinski avatar ocram avatar olefav avatar skorobagatko avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.