# Using Random Longer Non-Sequential IDs

**URL:** <https://www.ruby-forum.com/t/using-random-longer-non-sequential-ids/66322>\
**Category:** Rails\
**Created:** [February 13, 2006, 12:17am UTC](https://www.ruby-forum.com/t/using-random-longer-non-sequential-ids/66322 "2006-02-13T00:17:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![johnk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/59ef9b/32.png) [@johnk](https://www.ruby-forum.com/u/johnk)\
**Post date:** [February 13, 2006, 12:17am UTC](https://www.ruby-forum.com/t/using-random-longer-non-sequential-ids/66322/1 "2006-02-13T00:17:45Z")

</div>

Instead of using sequential integers for IDs for my objects I was  
wondering if I could easily make it so that my IDs where longer auto-  
generated random strings/integers.

So instead of:  
[http://www.mydomain.com/user/view/1](http://www.mydomain.com/user/view/1)

Would be:

[http://www.mydomain.com/user/view/d81096b87a7c5565f](http://www.mydomain.com/user/view/d81096b87a7c5565f)

On top of that… is there big benefits for security reasons to use  
non-sequential numbers? Is it worth it?

Thanks 🙂

John K.  
[http://www.kopanas.com](http://www.kopanas.com)

=====================================================================  
[http://www.soen.info](http://www.soen.info) - source of the freshest software engineering  
information on the net  
[http://cusec.soen.info](http://cusec.soen.info) - software engineering conference

---

<div class="post-metadata">

**Author:** ![johnk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/59ef9b/32.png) [@johnk](https://www.ruby-forum.com/u/johnk)\
**Post date:** [February 13, 2006, 12:42am UTC](https://www.ruby-forum.com/t/using-random-longer-non-sequential-ids/66322/2 "2006-02-13T00:42:33Z")

</div>

On Feb 12, 2006, at 3:17 PM, John K. wrote:

> On top of that… is there big benefits for security reasons to use  
> non-sequential numbers? Is it worth it?

No, security through obscurity will just give you a false sense of  
security.

–  
– Tom M.

---

<div class="post-metadata">

**Author:** ![johnk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/59ef9b/32.png) [@johnk](https://www.ruby-forum.com/u/johnk)\
**Post date:** [February 13, 2006, 1:23am UTC](https://www.ruby-forum.com/t/using-random-longer-non-sequential-ids/66322/3 "2006-02-13T01:23:01Z")

</div>

On Sunday, February 12, 2006, at 6:17 PM, John K. wrote:

> [http://www.soen.info](http://www.soen.info) - source of the freshest software engineering  
> information on the net  
> [http://cusec.soen.info](http://cusec.soen.info) - software engineering conference
> 
> * * *
> 
> Rails mailing list  
> removed\_email\_address@domain.invalid  
> [http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)

You can add an extra column to your table and generate random unique id  
(unique secondary key). We used this approach to display order pages on

> **[Password Manager for Families, Businesses, Teams | 1Password](https://1password.com)**
>
> A password manager, digital vault, form filler and secure digital wallet. 1Password remembers all your passwords for you to help keep account information safe.

Best Regards, Roustem.
