module HexaPDF::Encryption::ARC4::ClassMethods
Convenience methods for decryption and encryption that operate according to the PDF specification.
These methods will be available on the class object that prepends the ARC4
module.
Public Instance Methods
encrypt(key, data)
click to toggle source
Encrypts the given data
with the key
.
See: PDF1.7 s7.6.2.
# File lib/hexapdf/encryption/arc4.rb, line 68 def encrypt(key, data) new(key).process(data) end
Also aliased as: decrypt
encryption_fiber(key, source)
click to toggle source
Returns a Fiber object that encrypts the data from the given source fiber with the key
.
# File lib/hexapdf/encryption/arc4.rb, line 75 def encryption_fiber(key, source) Fiber.new do algorithm = new(key) while source.alive? && (data = source.resume) Fiber.yield(algorithm.process(data)) unless data.empty? end end end
Also aliased as: decryption_fiber