Class: Zweifische::ZeroPadding
- Inherits:
-
Object
- Object
- Zweifische::ZeroPadding
- Defined in:
- lib/zweifische/zero_padding.rb
Class Method Summary collapse
Class Method Details
.pad(num) ⇒ Object
3 4 5 6 |
# File 'lib/zweifische/zero_padding.rb', line 3 def self.pad(num) raise ArgumentError.new("max pad is 16 bytes") if num > 15 || num < 0 0x00.chr * num end |
.unpad(text) ⇒ Object
8 9 10 |
# File 'lib/zweifische/zero_padding.rb', line 8 def self.unpad(text) text.gsub(/\x00+\z/, "") end |