Module: ScatterSwap
- Defined in:
- lib/scatter_swap.rb,
lib/scatter_swap/hasher.rb,
lib/scatter_swap/version.rb
Defined Under Namespace
Classes: Hasher
Constant Summary collapse
- VERSION =
'0.1.0'
Class Method Summary collapse
-
.hash(plain_integer, spin = 0, length = 10) ⇒ String
Hash the given
plain_integer
into its obfuscatedString
form. -
.reverse_hash(hashed_integer, spin = 0, length = 10) ⇒ String
Reverse
hashed_integer
from its obfuscated form to its serial value.
Class Method Details
.hash(plain_integer, spin = 0, length = 10) ⇒ String
Note:
To obtain the corresponding hashed integer value call hash(plain_integer).to_i
Hash the given plain_integer
into its obfuscated String
form.
14 15 16 |
# File 'lib/scatter_swap.rb', line 14 def self.hash(plain_integer, spin = 0, length = 10) Hasher.new(plain_integer, spin, length).hash end |
.reverse_hash(hashed_integer, spin = 0, length = 10) ⇒ String
Note:
To obtain the corresponding reverse-hashed integer value call reverse_hash(hashed_integer).to_i
Reverse hashed_integer
from its obfuscated form to its serial value.
27 28 29 |
# File 'lib/scatter_swap.rb', line 27 def self.reverse_hash(hashed_integer, spin = 0, length = 10) Hasher.new(hashed_integer, spin, length).reverse_hash end |