diff --git a/lib/private/files/storage/common.php b/lib/private/files/storage/common.php
index 2b697141515655801dae3b75fcd2aa583952156e..05e031b37ad36035c1311bb7207f540fd1d5fd16 100644
--- a/lib/private/files/storage/common.php
+++ b/lib/private/files/storage/common.php
@@ -159,9 +159,11 @@ abstract class Common implements \OC\Files\Storage\Storage {
 	}
 
 	public function hash($type, $path, $raw = false) {
-		$tmpFile = $this->getLocalFile($path);
-		$hash = hash_file($type, $tmpFile, $raw);
-		return $hash;
+		$fh = $this->fopen($path, 'r');
+		$ctx = hash_init($type);
+		hash_update_stream($ctx, $fh);
+		fclose($fh);
+		return hash_final($ctx, $raw);
 	}
 
 	public function search($query) {