lib/em-mongo/support.rb in em-mongo-0.5.1 vs lib/em-mongo/support.rb in em-mongo-0.6.0
- old
+ new
@@ -14,35 +14,25 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ++
-require 'digest/md5'
+require 'openssl'
module EM::Mongo
module Support
include EM::Mongo::Conversions
extend self
- # Generate an MD5 for authentication.
- #
- # @param [String] username
- # @param [String] password
- # @param [String] nonce
- #
- # @return [String] a key for db authentication.
- def auth_key(username, password, nonce)
- Digest::MD5.hexdigest("#{nonce}#{username}#{hash_password(username, password)}")
- end
# Return a hashed password for auth.
#
# @param [String] username
# @param [String] plaintext
#
# @return [String]
def hash_password(username, plaintext)
- Digest::MD5.hexdigest("#{username}:mongo:#{plaintext}")
+ OpenSSL::Digest::MD5.hexdigest("#{username}:mongo:#{plaintext}")
end
def validate_db_name(db_name)
unless [String, Symbol].include?(db_name.class)