Module: IntegerHash
- Defined in:
- lib/integer_hash.rb,
lib/integer_hash/rails.rb,
lib/integer_hash/version.rb,
lib/integer_hash/generator.rb,
lib/integer_hash/configuration.rb
Defined Under Namespace
Modules: Rails
Classes: Configuration, Generator
Constant Summary
collapse
- VERSION =
"0.1.0"
Class Method Summary
collapse
Class Method Details
.configuration ⇒ Object
16
17
18
|
# File 'lib/integer_hash/configuration.rb', line 16
def self.configuration
@configuration ||= Configuration.new
end
|
.configuration=(config) ⇒ Object
20
21
22
|
# File 'lib/integer_hash/configuration.rb', line 20
def self.configuration=(config)
@configuration = config
end
|
24
25
26
|
# File 'lib/integer_hash/configuration.rb', line 24
def self.configure
yield configuration
end
|
.decode(value) ⇒ Object
10
11
12
|
# File 'lib/integer_hash.rb', line 10
def self.decode(value)
((value ^ random_integer) * inverse_integer) & max_integer
end
|
.encode(value) ⇒ Object
6
7
8
|
# File 'lib/integer_hash.rb', line 6
def self.encode(value)
((value * prime) & max_integer) ^ random_integer
end
|