Skip to content

Commit

Permalink
fixed up readme, and obfuscate_id
Browse files Browse the repository at this point in the history
  • Loading branch information
namick committed Feb 12, 2012
1 parent 3e1ac9d commit 6a72f55
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 21 deletions.
2 changes: 1 addition & 1 deletion MIT-LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright 2012 YOURNAME
Copyright 2012 Nathan Amick

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
Expand Down
32 changes: 19 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,37 +1,36 @@
# ObfuscateId

ObfuscateId is a simple plugin that hides your sequential numerical ids in a shroud of secrecy.
ObfuscateId is a simple Ruby on Rails plugin that hides your seqential Active Record ids. Although having nothing to do with security, it can be used to make database record id information non-obvious.

Every website has a third user, but that third user doesn't have to know he is the third user.
For new websites, you may not want to give away information about how many people are signed up. Every website has a third user, but that third user doesn't have to know he is the third user.

ObfuscateId turns a URL like this:

http://example.com/users/3

into something like:

http://example.com/users/235651390
http://example.com/users/2356513904

ObfuscateId mixes up the ids in a simple, reversable hashing algorithm so that it can then automatically revert the hashed number back to 3 for record lookup without having to store a hash or tag in the database. No migrations needed.

and then automatically reverts the id back to 3 for record lookup without having to store a hash or tag in the database.

Or maybe you have the opposite problem, your site is scaling well, you are getting 50 new posts a minute, but do you want to leak that information?
If you have the opposite problem, and your site is scaling well, you might not want to leak that you are getting 50 new posts a minute.

ObfuscateId turns your sequential Active Record ids into non-sequential, random looking, numeric ids.

# post 7000
http://example.com/posts/527019235
http://example.com/posts/5270192353
# post 7001
http://example.com/posts/710716382
http://example.com/posts/7107163820
# post 7002
http://example.com/posts/329616382
http://example.com/posts/3296163828

## Features

* Extreemly simple. A single line of code in the model turns it on.
* No database changes are needed. The record is still stored in the database with its original id.
* Creates a random looking integer which hides the id but still looks cleaner than a using an encrypted hash
* Fast, no heavy calculation
* Supported by all common Rails databases.
* No migrations or database changes are needed. The record is still stored in the database with its original id.
* Creates a random looking integer which hides the id but still looks cleaner than a using an encrypted hash.
* Fast, no heavy calculation.


## Installation
Expand All @@ -54,4 +53,11 @@ Then, in your model, add a single line.
obfuscate_id
end

## Customization

If you want your obfuscated ids to be different than some other website using the same plugin, you can throw a random number (spin) at obfuscate_id to make it hash out unique ids.

class Post < ActiveRecord::Base
obfuscate_id :spin => 89238723
end

2 changes: 1 addition & 1 deletion lib/obfuscate_id/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module ObfuscateId
VERSION = "0.0.1"
VERSION = "0.0.1.alpha"
end
12 changes: 6 additions & 6 deletions obfuscate_id.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ require "obfuscate_id/version"
Gem::Specification.new do |s|
s.name = "obfuscate_id"
s.version = ObfuscateId::VERSION
s.authors = ["TODO: Your name"]
s.email = ["TODO: Your email"]
s.homepage = "TODO"
s.summary = "TODO: Summary of ObfuscateId."
s.description = "TODO: Description of ObfuscateId."
s.authors = ["Nathan Amick"]
s.email = ["github@nathanamick.com"]
s.homepage = ""
s.summary = "A simple Rails plugin that lightly hides seqential ActiveRecord ids"
s.description = "ObfuscateId is a simple Ruby on Rails plugin that hides your seqential Active Record ids. Although having nothing to do with security, it can be used to make database record id information non-obvious."

s.files = Dir["{app,config,db,lib}/**/*"] + ["MIT-LICENSE", "Rakefile", "README.rdoc"]
s.files = Dir["{app,config,db,lib}/**/*"] + ["MIT-LICENSE", "Rakefile", "README.md"]

s.add_dependency "rails", "~> 3.2.1"

Expand Down

0 comments on commit 6a72f55

Please sign in to comment.