class OpenPGP::S2K::Salted
Constants
- IDENTIFIER
Attributes
salt[RW]
@return [String]
Public Class Methods
new(passphrase = nil, options = {}, &block)
click to toggle source
@param [String, to_s
] passphrase @param [Hash{Symbol => Object}] options
Calls superclass method
OpenPGP::S2K::new
# File lib/openpgp/s2k.rb, line 147 def initialize(passphrase = nil, options = {}, &block) super(passphrase, options, &block) @salt = Random.bytes(8) unless @salt end
parse(input)
click to toggle source
@param [Buffer] input @return [S2K]
# File lib/openpgp/s2k.rb, line 137 def self.parse(input) self.new(nil, :algorithm => input.read_byte, :salt => input.read_bytes(8)) end
Public Instance Methods
digest_input()
click to toggle source
@return [String]
# File lib/openpgp/s2k.rb, line 168 def digest_input salt.to_s[0, 8] << passphrase end
to_hash()
click to toggle source
@return [Hash]
Calls superclass method
OpenPGP::S2K#to_hash
# File lib/openpgp/s2k.rb, line 162 def to_hash super.merge({:salt => salt}) end
write(buffer)
click to toggle source
@param [Buffer] buffer @return [void]
Calls superclass method
OpenPGP::S2K#write
# File lib/openpgp/s2k.rb, line 155 def write(buffer) super(buffer) buffer.write_bytes(salt) end