replaced usage of md5/sha1 by sha256
authorFabien Potencier <fabien.potencier@gmail.com>
Sun, 4 Aug 2013 13:12:06 +0000 (15:12 +0200)
committerFabien Potencier <fabien.potencier@gmail.com>
Sun, 4 Aug 2013 13:12:06 +0000 (15:12 +0200)
lib/Twig/Environment.php
lib/Twig/Parser.php
test/Twig/Tests/Node/ModuleTest.php
test/Twig/Tests/Node/SandboxedModuleTest.php

index d11df2e..09ea4a2 100644 (file)
@@ -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;
     }
 
     /**
index 958e46b..bebdd9b 100644 (file)
@@ -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()
index 7dde513..23c66c6 100644 (file)
@@ -65,7 +65,7 @@ class Twig_Tests_Node_ModuleTest extends Twig_Test_NodeTestCase
 <?php
 
 /* foo.twig */
-class __TwigTemplate_be925a7b06dda0dfdbd18a1509f7eb34 extends Twig_Template
+class __TwigTemplate_a2bfbf7dd6ab85666684fe9297f69363a3fc2046d90f22a317d380c18638df0d extends Twig_Template
 {
     public function __construct(Twig_Environment \$env)
     {
@@ -109,7 +109,7 @@ EOF
 <?php
 
 /* foo.twig */
-class __TwigTemplate_be925a7b06dda0dfdbd18a1509f7eb34 extends Twig_Template
+class __TwigTemplate_a2bfbf7dd6ab85666684fe9297f69363a3fc2046d90f22a317d380c18638df0d extends Twig_Template
 {
     public function __construct(Twig_Environment \$env)
     {
@@ -167,7 +167,7 @@ EOF
 <?php
 
 /* foo.twig */
-class __TwigTemplate_be925a7b06dda0dfdbd18a1509f7eb34 extends Twig_Template
+class __TwigTemplate_a2bfbf7dd6ab85666684fe9297f69363a3fc2046d90f22a317d380c18638df0d extends Twig_Template
 {
     protected function doGetParent(array \$context)
     {
index cec94ca..1d4b3f6 100644 (file)
@@ -63,7 +63,7 @@ class Twig_Tests_Node_SandboxedModuleTest extends Twig_Test_NodeTestCase
 <?php
 
 /* foo.twig */
-class __TwigTemplate_be925a7b06dda0dfdbd18a1509f7eb34 extends Twig_Template
+class __TwigTemplate_a2bfbf7dd6ab85666684fe9297f69363a3fc2046d90f22a317d380c18638df0d extends Twig_Template
 {
     public function __construct(Twig_Environment \$env)
     {
@@ -121,7 +121,7 @@ EOF
 <?php
 
 /* foo.twig */
-class __TwigTemplate_be925a7b06dda0dfdbd18a1509f7eb34 extends Twig_Template
+class __TwigTemplate_a2bfbf7dd6ab85666684fe9297f69363a3fc2046d90f22a317d380c18638df0d extends Twig_Template
 {
     public function __construct(Twig_Environment \$env)
     {