diff --git a/ckanext/odsh/tools.py b/ckanext/odsh/tools.py
index ca7d69a7cfacb82981da9fed6125de04a6fed67e..22b999b38d4a163f536510730a3db3e78910f83c 100644
--- a/ckanext/odsh/tools.py
+++ b/ckanext/odsh/tools.py
@@ -9,9 +9,10 @@ def save_hash_into_resource(context, resource):
         with open(path, 'rb') as file:
             hash = calculate_hash(file)
             package = update_last_resource_if_value_empty(context, resource, 'hash', hash)
+            resources = package.get('resources')
+            last_resource = resources.pop()    
+            if last_resource.get(hash) and not last_resource.get('hash_algorithm'): 
+                last_resource.update({'hash_algorithm': 'http://dcat-ap.de/def/hashAlgorithms/md/5'})
+                resources.append(last_resource)
+                package.update({'resources':resources})
         toolkit.get_action('package_update')(context, package)
-
-    
-
-
-