Merge "Switch back to built-in md5 method"
diff --git a/tempest/api/object_storage/test_object_services.py b/tempest/api/object_storage/test_object_services.py
index 8110915..00cd347 100644
--- a/tempest/api/object_storage/test_object_services.py
+++ b/tempest/api/object_storage/test_object_services.py
@@ -13,12 +13,12 @@
 #    License for the specific language governing permissions and limitations
 #    under the License.
 
+import hashlib
 import random
 import re
 import time
 import zlib
 
-from oslo_utils.secretutils import md5
 from tempest.api.object_storage import base
 from tempest.common import custom_matchers
 from tempest import config
@@ -158,7 +158,7 @@
         object_name = data_utils.rand_name(
             prefix=CONF.resource_name_prefix, name='TestObject')
         data = data_utils.random_bytes()
-        create_md5 = md5(data, usedforsecurity=False).hexdigest()
+        create_md5 = hashlib.md5(data, usedforsecurity=False).hexdigest()
         metadata = {'Etag': create_md5}
         resp, _ = self.object_client.create_object(
             self.container_name,
@@ -661,7 +661,7 @@
         object_name = data_utils.rand_name(
             prefix=CONF.resource_name_prefix, name='TestObject')
         data = data_utils.random_bytes(10)
-        create_md5 = md5(data, usedforsecurity=False).hexdigest()
+        create_md5 = hashlib.md5(data, usedforsecurity=False).hexdigest()
         create_metadata = {'Etag': create_md5}
         self.object_client.create_object(self.container_name,
                                          object_name,
@@ -703,7 +703,7 @@
         object_name = data_utils.rand_name(
             prefix=CONF.resource_name_prefix, name='TestObject')
         data = data_utils.random_bytes()
-        create_md5 = md5(data, usedforsecurity=False).hexdigest()
+        create_md5 = hashlib.md5(data, usedforsecurity=False).hexdigest()
         create_metadata = {'Etag': create_md5}
         self.object_client.create_object(self.container_name,
                                          object_name,
@@ -711,7 +711,7 @@
                                          metadata=create_metadata)
 
         list_data = data_utils.random_bytes()
-        list_md5 = md5(list_data, usedforsecurity=False).hexdigest()
+        list_md5 = hashlib.md5(list_data, usedforsecurity=False).hexdigest()
         list_metadata = {'If-None-Match': list_md5}
         resp, body = self.object_client.get_object(
             self.container_name,
@@ -1011,7 +1011,7 @@
         """
         object_name, data = self.create_object(self.container_name)
         # local copy is identical, no download
-        object_md5 = md5(data, usedforsecurity=False).hexdigest()
+        object_md5 = hashlib.md5(data, usedforsecurity=False).hexdigest()
         headers = {'If-None-Match': object_md5}
         url = "%s/%s" % (self.container_name, object_name)
         resp, _ = self.object_client.get(url, headers=headers)
@@ -1026,7 +1026,8 @@
 
         # local copy is different, download
         local_data = "something different"
-        other_md5 = md5(local_data.encode(), usedforsecurity=False).hexdigest()
+        other_md5 = hashlib.md5(
+            local_data.encode(), usedforsecurity=False).hexdigest()
         headers = {'If-None-Match': other_md5}
         resp, _ = self.object_client.get(url, headers=headers)
         self.assertHeaders(resp, 'Object', 'GET')
diff --git a/tempest/api/object_storage/test_object_slo.py b/tempest/api/object_storage/test_object_slo.py
index b8e0b55..0cf493b 100644
--- a/tempest/api/object_storage/test_object_slo.py
+++ b/tempest/api/object_storage/test_object_slo.py
@@ -12,9 +12,10 @@
 #    License for the specific language governing permissions and limitations
 #    under the License.
 
+import hashlib
+
 from oslo_serialization import jsonutils as json
 
-from oslo_utils.secretutils import md5
 from tempest.api.object_storage import base
 from tempest.common import utils
 from tempest import config
@@ -66,14 +67,20 @@
                                     object_name_base_1)
         path_object_2 = '/%s/%s' % (self.container_name,
                                     object_name_base_2)
-        data_manifest = [{'path': path_object_1,
-                          'etag': md5(self.content,
-                                      usedforsecurity=False).hexdigest(),
-                          'size_bytes': data_size},
-                         {'path': path_object_2,
-                          'etag': md5(self.content,
-                                      usedforsecurity=False).hexdigest(),
-                          'size_bytes': data_size}]
+        data_manifest = [
+            {
+                'path': path_object_1,
+                'etag': hashlib.md5(
+                    self.content, usedforsecurity=False).hexdigest(),
+                'size_bytes': data_size
+            },
+            {
+                'path': path_object_2,
+                'etag': hashlib.md5(
+                    self.content, usedforsecurity=False).hexdigest(),
+                'size_bytes': data_size
+            }
+        ]
 
         return json.dumps(data_manifest)
 
diff --git a/tempest/lib/common/preprov_creds.py b/tempest/lib/common/preprov_creds.py
index f3a84d6..e685c2c 100644
--- a/tempest/lib/common/preprov_creds.py
+++ b/tempest/lib/common/preprov_creds.py
@@ -12,11 +12,11 @@
 #    License for the specific language governing permissions and limitations
 #    under the License.
 
+import hashlib
 import os
 
 from oslo_concurrency import lockutils
 from oslo_log import log as logging
-from oslo_utils.secretutils import md5
 import yaml
 
 from tempest.lib import auth
@@ -134,7 +134,7 @@
                 scope = 'domain'
             elif 'system' in account:
                 scope = 'system'
-            temp_hash = md5(usedforsecurity=False)
+            temp_hash = hashlib.md5(usedforsecurity=False)
             account_for_hash = dict((k, v) for (k, v) in account.items()
                                     if k in cls.HASH_CRED_FIELDS)
             temp_hash.update(str(account_for_hash).encode('utf-8'))
diff --git a/tempest/lib/common/ssh.py b/tempest/lib/common/ssh.py
index aad04b8..cc318db 100644
--- a/tempest/lib/common/ssh.py
+++ b/tempest/lib/common/ssh.py
@@ -13,7 +13,7 @@
 #    License for the specific language governing permissions and limitations
 #    under the License.
 
-
+import hashlib
 import io
 import select
 import socket
@@ -21,7 +21,6 @@
 import warnings
 
 from oslo_log import log as logging
-from oslo_utils.secretutils import md5
 
 from tempest.lib import exceptions
 
@@ -43,7 +42,7 @@
     TODO(alee) Remove this when paramiko is patched.
     See https://github.com/paramiko/paramiko/pull/1928
     """
-    return md5(self.asbytes(), usedforsecurity=False).digest()
+    return hashlib.md5(self.asbytes(), usedforsecurity=False).digest()
 
 
 paramiko.pkey.PKey.get_fingerprint = get_fingerprint
diff --git a/tempest/tests/lib/common/test_preprov_creds.py b/tempest/tests/lib/common/test_preprov_creds.py
index 5a36f71..c5eaf7e 100644
--- a/tempest/tests/lib/common/test_preprov_creds.py
+++ b/tempest/tests/lib/common/test_preprov_creds.py
@@ -12,6 +12,7 @@
 #    License for the specific language governing permissions and limitations
 #    under the License.
 
+import hashlib
 import os
 import shutil
 from unittest import mock
@@ -21,7 +22,6 @@
 import fixtures
 from oslo_concurrency.fixture import lockutils as lockutils_fixtures
 from oslo_config import cfg
-from oslo_utils.secretutils import md5
 
 from tempest import config
 from tempest.lib import auth
@@ -111,7 +111,7 @@
         hash_fields = (
             preprov_creds.PreProvisionedCredentialProvider.HASH_CRED_FIELDS)
         for account in accounts_list:
-            hash = md5(usedforsecurity=False)
+            hash = hashlib.md5(usedforsecurity=False)
             account_for_hash = dict((k, v) for (k, v) in account.items()
                                     if k in hash_fields)
             hash.update(str(account_for_hash).encode('utf-8'))