Giter Site home page Giter Site logo

hashids.java's People

Contributors

peet avatar yissachar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

hashids.java's Issues

Hashes of java implementation don't match output of hashids.js

I'd say it renders this library pretty much useless!

Java

Hashids hashids = new Hashids("this is my salt");
String hash = hashids.encrypt(12345);
=> hash: ryBo

JavaScript

var hashids = new Hashids("this is my salt"),
hash = hashids.encrypt(12345),
=> hash: NkK9

Add option to remove vowels

Commenting on the bad words issue, most readable words have vowels in them. Since bad words are also readable (duh!), it would be nice to simply skip all the vowels altogether.

Cannot decode values larger than max int

Hashids hashids = new Hashids("some salt");
System.out.println(hashids.decrypt(hashids.encrypt(2147483647L)).length); // 1
System.out.println(hashids.decrypt(hashids.encrypt(2147483648L)).length); // 0

Encoding seems to work fine.

Based on the README this doesn't seem to be by design.

Negative Long Number

Hey,

I just figured out your script does not support negative numbers. Long, however, includes a full range of negative numbers.
I see 2 options to solve the issue:

  1. Choose another datatype to restrict to positive numbers.
  2. Improve the code, e.g., by mapping long values to big positive numbers.

I will try to figure out the latter.

Cheers

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.