From 9e37d88d69ebfa31224fe066f501cd3e23343b8f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andreas=20=C3=85kre=20Solberg?= <andreas.solberg@uninett.no>
Date: Fri, 25 Sep 2009 09:54:23 +0000
Subject: [PATCH] Fix for random byte generation in MIME email messages

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@1789 44740490-163a-0410-bde0-09ae8108e29a
---
 lib/SimpleSAML/XHTML/EMail.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/SimpleSAML/XHTML/EMail.php b/lib/SimpleSAML/XHTML/EMail.php
index 19b97a028..4c5385e5e 100644
--- a/lib/SimpleSAML/XHTML/EMail.php
+++ b/lib/SimpleSAML/XHTML/EMail.php
@@ -66,7 +66,7 @@ pre {
 		if ($this->subject == NULL) throw new Exception('EMail field [subject] is required and not set.');
 		if ($this->body == NULL) throw new Exception('EMail field [body] is required and not set.');
 		
-		$random_hash = substr(0, 16, md5(date('r', time())));
+		$random_hash = SimpleSAML_Utilities::stringToHex(SimpleSAML_Utilities::generateRandomBytes(16));
 		
 		if (isset($this->from))
 			$this->headers[]= 'From: ' . $this->from;
-- 
GitLab