lib/lastpass/fetcher.rb in lastpass-1.4.0 vs lib/lastpass/fetcher.rb in lastpass-1.5.0

- old
+ new

@@ -25,11 +25,11 @@ Blob.new decode_blob(response.parsed_response), session.key_iteration_count end def self.request_iteration_count username, web_client = http response = web_client.post "https://lastpass.com/iterations.php", - query: {email: username} + body: {email: username} raise NetworkError unless response.response.is_a? Net::HTTPOK begin count = Integer response.parsed_response @@ -115,29 +115,22 @@ def self.make_key username, password, key_iteration_count if key_iteration_count == 1 Digest::SHA256.digest username + password else - PBKDF2 - .new(password: password, - salt: username, - iterations: key_iteration_count, - key_length: 32) - .bin_string - .force_encoding "BINARY" + OpenSSL::PKCS5.pbkdf2_hmac password, username, key_iteration_count, 32, "sha256" end end def self.make_hash username, password, key_iteration_count if key_iteration_count == 1 Digest::SHA256.hexdigest Digest.hexencode(make_key(username, password, 1)) + password else - PBKDF2 - .new(password: make_key(username, password, key_iteration_count), - salt: password, - iterations: 1, - key_length: 32) - .hex_string + Digest.hexencode OpenSSL::PKCS5.pbkdf2_hmac make_key(username, password, key_iteration_count), + password, + 1, + 32, + "sha256" end end def self.http @http ||= HTTP