Class: Zweifische::PKCS7Padding
- Inherits:
-
AnsiX923Padding
- Object
- AnsiX923Padding
- Zweifische::PKCS7Padding
- Defined in:
- lib/zweifische/pkcs7_padding.rb
Class Method Summary collapse
Class Method Details
.pad(num) ⇒ Object
3 4 5 6 |
# File 'lib/zweifische/pkcs7_padding.rb', line 3 def self.pad(num) raise ArgumentError.new("max pad is 16 bytes") if num > 15 || num < 0 num.chr * num end |
.unpad(text) ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/zweifische/pkcs7_padding.rb', line 8 def self.unpad(text) numpad = numpad(text) if assert_pad(text, numpad, numpad.chr) return text[0..(-1 * (numpad + 1))] end text end |