Sha256: 87648d5612a2eb454276fd2a91425de078d0aadac289576807b38f4840541b39
Contents?: true
Size: 1.04 KB
Versions: 25
Compression:
Stored size: 1.04 KB
Contents
module Vertica module Messages class Password < FrontendMessage message_id 'p' def initialize(password, auth_method = nil, options = {}) @password = password @auth_method = auth_method || Vertica::Messages::Authentication::CLEARTEXT_PASSWORD @options = options end def encoded_password case @auth_method when Vertica::Messages::Authentication::CLEARTEXT_PASSWORD @password when Vertica::Messages::Authentication::CRYPT_PASSWORD @password.crypt(@options[:salt]) when Vertica::Messages::Authentication::MD5_PASSWORD require 'digest/md5' @password = Digest::MD5.hexdigest(@password + @options[:user]) @password = Digest::MD5.hexdigest(@password + @options[:salt]) @password = 'md5' + @password else raise ArgumentError.new("unsupported authentication method: #{@auth_method}") end end def to_bytes message_string [encoded_password].pack('Z*') end end end end
Version data entries
25 entries across 25 versions & 1 rubygems