From 260620ee788a6492a7f7eaeb84c6c8d6dfe489ab Mon Sep 17 00:00:00 2001 From: Chris Kankiewicz Date: Thu, 4 Jun 2020 11:08:05 -0700 Subject: [PATCH] Use sha1 for cache keys --- app/src/Controllers/FileInfoController.php | 2 +- app/src/Controllers/ZipController.php | 2 +- app/src/ViewFunctions/Markdown.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/Controllers/FileInfoController.php b/app/src/Controllers/FileInfoController.php index 61deb70..02e0d6f 100644 --- a/app/src/Controllers/FileInfoController.php +++ b/app/src/Controllers/FileInfoController.php @@ -63,7 +63,7 @@ class FileInfoController } $response->getBody()->write($this->cache->get( - sprintf('file-info-%s', md5($file->getRealPath())), + sprintf('file-info-%s', sha1($file->getRealPath())), function () use ($file): string { return json_encode(['hashes' => $this->calculateHashes($file)]); } diff --git a/app/src/Controllers/ZipController.php b/app/src/Controllers/ZipController.php index 62425e0..7c358fa 100644 --- a/app/src/Controllers/ZipController.php +++ b/app/src/Controllers/ZipController.php @@ -65,7 +65,7 @@ class ZipController } $response->getBody()->write( - $this->cache->get(sprintf('zip-%s', md5($path)), function () use ($path): string { + $this->cache->get(sprintf('zip-%s', sha1($path)), function () use ($path): string { return $this->createZip($path)->getContents(); }) ); diff --git a/app/src/ViewFunctions/Markdown.php b/app/src/ViewFunctions/Markdown.php index 42590c0..0587c40 100644 --- a/app/src/ViewFunctions/Markdown.php +++ b/app/src/ViewFunctions/Markdown.php @@ -32,7 +32,7 @@ class Markdown extends ViewFunction public function __invoke(string $string): string { return $this->cache->get( - sprintf('markdown-%s', md5($string)), + sprintf('markdown-%s', sha1($string)), function () use ($string): string { return $this->parser->parse($string); }