Git Product home page Git Product logo

Comments (5)

peterhellberg avatar peterhellberg commented on June 30, 2024

I'm not sure that I see any benefit to this since you could just create the alphabet string from an array.

alphabet = ['a1', 'b2', 'c3', 'd4', 'e5', 'f6', 'g7', 'h8']
hashids = Hashids.new("this is my salt", 0, alphabet.join)
hash = hashids.encode(1) # => "g5"

I'd prefer not to change the behavior of this package too much, especially not the public API.

EDIT: Ah, now I understand what you meant, that you want to substitute 1 character for n-characters, but that would defeat the purpose of this package and algorithm (and break compatibility with all other hashids implementations)

from hashids.rb.

davydovanton avatar davydovanton commented on June 30, 2024

Thanks for quick reply 💯

  1. for example, I want to use sequence of chars like: ['a1', 'a2', 'b1', 'b2']. In current realization it will be like: 'a1a2b1b2' or just 'ab12'. In this case, we'll have something like aab2 instead a1b1
  2. It should be optional (I forgot to add it, sorry)

from hashids.rb.

peterhellberg avatar peterhellberg commented on June 30, 2024

I will not consider anything that would break compatibility with the http://hashids.org/ specification.

from hashids.rb.

davydovanton avatar davydovanton commented on June 30, 2024

okay, I got your point. Thanks, I'll close the issue 💗

from hashids.rb.

vkorobkov avatar vkorobkov commented on June 30, 2024

I would anticipate such a feature. There is a big problem when you generated public ids: how to remove or to skip bad words/phrases, including all the slang and the live nature of the language.

One of the best solutions, imo, which does not need curse words dictionaries/NLP analysis and which works well is to have a predefined safe alphabet like A0, B5 and so on so any combination is never a bad word.

Don't see why alphabet can not be an array of strings instead of array of characters?

from hashids.rb.

Related Issues (16)

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.