Skip to content

Generic shortcode URL implementation in CSharp.

License

Notifications You must be signed in to change notification settings

hueifeng/TinyURL

Repository files navigation

A simple, stable, safe, and fast short-chain generation library.

nuget NETCore stats MIT

Description

Language: English | 中文

The shortcode is composed of 62 characters of [a-z, A-Z, 0-9], the length of the shortcode is 6 digits, and the 6-digit shortcode supports 56.8 billion combinations: (26+26+10)^6 =568002355884.

Features

  • Flexible reference library, easy to use
  • Persistent storage of original data
  • Self-increasing ID and MurmurHash algorithm are adopted to ensure the safety and reliability of shortcode without collision

Quick Start

1、Install Package

Install-Package TinyURL

2、Install the persistence library

Install-Package TinyURL.SqlServer

3、Short code

TinyURL shortUrl = new TinyURL(
      new SqlServerStorageProcessor("Server=localhost;Database=TestDb;Trusted_Connection=True;"));
await shortUrl.Generator(url);

Table Structure

Table UrlDictionary
Name Type Details
Id [int] IDENTITY(1,1) NOT NULL identity ID
Code [nvarchar] (6) short code
URL [nvarchar] (128) Original link
HashVal [nvarchar] (32) Hash Value
InsertAt [datetime] Creation time

Contribution

If you have any ideas you can join in, or find that there is code in this project that needs improvement, welcome to Fork and submit a PR!

License

MIT

About

Generic shortcode URL implementation in CSharp.

Topics

Resources

License

Stars

Watchers

Forks

Packages 3

 
 
 

Languages