On May 31, 2013, at 16:01, Alex Kocharin wrote:

> If you want small changes in the input to affect all bits in the output, then 
> yes, that's what good ciphers are doing. If you just want users to clearly 
> distinguish one value from another, that will do fine. I just hope you aren't 
> going to use 64bit cipher to ensure unpredictability of ids…

I don't care if someone guesses an id; the resources would be public, like 
youtube videos or shortened urls. And for any ids that aren't supposed to be 
public, they'd be properly protected against unauthorized access.


> I don't know what base56 is... But you can just use base64. Youtube uses 
> URL-base64 encoding replacing last two chars with "-" and "_".
> 
> But anyway... mongodb id is 12 bytes. It would be 16 bytes base64-encoded. 
> That's too long, and I'd very much like to see a solution to create shorter 
> or more user-friendly ids.
> 
> Did you think about assigning auto-incrementing number to a message? Or a 
> string like "user_number"? Or whatever... mongodb _ids are very much 
> necessary, but they don't always need to be exposed to user.

I have briefly considered that. And using hashids with incrementing integers 
does produce pleasing short random-looking strings.

But mongodb doesn't have an autoincrement feature. They have documentation 
explaining how to fake it, and why it's problematic:

http://docs.mongodb.org/manual/tutorial/create-an-auto-incrementing-field/

-- 
-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to