Module: MissyElliott
- Defined in:
- lib/missy_elliott.rb,
lib/missy_elliott/version.rb
Constant Summary collapse
- VERSION =
"1.0.0"
Class Method Summary collapse
Class Method Details
.decode(input) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/missy_elliott.rb', line 10 def self.decode(input) input.bytes.map do |byte| bits = byte.to_s(2).rjust(8, "0").split("") bits = flip_it(bits.reverse) # Reverse it and flip it bits.unshift(bits.pop).join.to_i(2).chr # Shift yo bits up end.join end |
.encode(input) ⇒ Object
2 3 4 5 6 7 8 |
# File 'lib/missy_elliott.rb', line 2 def self.encode(input) input.bytes.map do |byte| bits = byte.to_s(2).rjust(8, "0").split("") bits << bits.shift # Shift yo bits down flip_it(bits).reverse.join.to_i(2).chr # Flip it and reverse it end.join end |