Closed iyahimovitz closed 8 years ago
Since we are using a salt, it might be a good idea to have a version as part of the actual id. I didn't get it.
I don't believe a mutable object would be good in this case anyway.
If you want another salt, create another instance. They are relatively cheap to create and you normally shouldn't need that much instances. Just reuse them.
Ops...
Since we are using a salt, it might be a good idea to have a version as part of the actual id.
I didn't get it...
I meant that if you encode a version together with the id later on you could map the version to the salt/alphabet you used, that way you could change it at any given time because you always use the version to choose the alphabet and the salt. Think about it as a simple mapping: version => (salt, alphabet)
Oh! Know I get it. :)
This is outside of the scope of the library, which is a port of js version. If we add this we would diverge.
This could be easily done by appending the version, a number, letter, or both to the generated hash, and before decode, you get the version and use the appropriate instance.
When I get back to my computer I'll write some code to demonstrate.
cool! that's what I figured. I just thought it's worthwhile to add it as a best practice. it's always a good idea to keep some version when encoding anything.
@itay1336 I will close this issue, any discussion about this we can move on :)
Since we are using a salt, it might be a good idea to have a version as part of the actual id. That will allow us to change the salt later if we need to. I'm not sure if this is out of scope for this library or maybe should be added as a best practice. What do you guys think?
Cheers, Itay