From 9a01db60e8b7552955cfcbef7caf0b24dc3119b4 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sun, 4 Aug 2013 15:12:06 +0200 Subject: [PATCH] replaced usage of md5/sha1 by sha256 --- lib/Twig/Environment.php | 2 +- lib/Twig/Parser.php | 2 +- test/Twig/Tests/Node/ModuleTest.php | 6 +++--- test/Twig/Tests/Node/SandboxedModuleTest.php | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/Twig/Environment.php b/lib/Twig/Environment.php index d11df2e..09ea4a2 100644 --- a/lib/Twig/Environment.php +++ b/lib/Twig/Environment.php @@ -270,7 +270,7 @@ class Twig_Environment return $this->templateClasses[$cls]; } - return $this->templateClasses[$cls] = $this->templateClassPrefix.md5($this->getLoader()->getCacheKey($name)).$suffix; + return $this->templateClasses[$cls] = $this->templateClassPrefix.hash('sha256', $this->getLoader()->getCacheKey($name)).$suffix; } /** diff --git a/lib/Twig/Parser.php b/lib/Twig/Parser.php index 958e46b..bebdd9b 100644 --- a/lib/Twig/Parser.php +++ b/lib/Twig/Parser.php @@ -49,7 +49,7 @@ class Twig_Parser implements Twig_ParserInterface public function getVarName() { - return sprintf('__internal_%s', hash('sha1', uniqid(mt_rand(), true), false)); + return sprintf('__internal_%s', hash('sha256', uniqid(mt_rand(), true), false)); } public function getFilename() diff --git a/test/Twig/Tests/Node/ModuleTest.php b/test/Twig/Tests/Node/ModuleTest.php index 7dde513..23c66c6 100644 --- a/test/Twig/Tests/Node/ModuleTest.php +++ b/test/Twig/Tests/Node/ModuleTest.php @@ -65,7 +65,7 @@ class Twig_Tests_Node_ModuleTest extends Twig_Test_NodeTestCase