A .NET version of Ivan Akimov's NodeJS hashids library.
C#
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
Hashids.net.test
Hashids.net
.gitignore
.travis.yml
CI.proj
README.md
hashids.net.sln

README.md

#hashids.net

A .NET version of Ivan Akimov's NodeJS hashids library.

Build Status

Usage:

// all params are optional (though you really should use a salt)
var hashids = new Hashids(
  salt: "this is my salt", 
  alphabet: "abcdefghijklmnopqrstuvwxyz0123456789", 
  minHashLength: 0
);

// encrypting 
// a simple long
var encrypted = hashids.Encrypt(1234567890); // result: "y2jl7rm5"
// N longs
encrypted = hashids.Encrypt(1234567890,9876543210,654987321,456123789)); 
// OR
encrypted = hashids.Encrypt(new List<long>(){1234567890,9876543210,654987321,456123789})); 
// result: "jxypk9w2frmlyvk19cqjr8jmeapj34ry7"

// decrypting
var decryptedLong = hashids.DecryptOne("y2jl7rm5"); // result: 1234567890
var decryptedListOfLongs = hashids.Decrypt("jxypk9w2frmlyvk19cqjr8jmeapj34ry7"); 
// result: List<long>(){ 1234567890,9876543210,654987321,456123789 }

TODO:

The C# needs some refactoring to be, well, more like what a C# developer might expect :)

Contributors:

License

The MIT License

Copyright (c) 2013 Mindflash, Inc.