0
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2024-11-09 15:28:40 +00:00

Use SHA-1 instead of MD5.

Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
This commit is contained in:
Edward Z. Yang 2012-10-27 02:33:22 -07:00
parent 087145a71b
commit 62d2550e16
2 changed files with 5 additions and 4 deletions

1
NEWS
View File

@ -14,6 +14,7 @@ NEWS ( CHANGELOG and HISTORY ) HTMLPurifier
this also means it's no longer possible to override attribute this also means it's no longer possible to override attribute
transforms in later modules. No internal code was using this transforms in later modules. No internal code was using this
but this may break some clients. but this may break some clients.
# We now use SHA-1 to identify cached definitions, instead of MD5.
! Support display:inline-block ! Support display:inline-block
! Support for more white-space CSS values. ! Support for more white-space CSS values.
! Permit underscores in font families ! Permit underscores in font families

View File

@ -189,7 +189,7 @@ class HTMLPurifier_Config
} }
/** /**
* Returns a md5 signature of a segment of the configuration object * Returns a SHA-1 signature of a segment of the configuration object
* that uniquely identifies that particular configuration * that uniquely identifies that particular configuration
* @note Revision is handled specially and is removed from the batch * @note Revision is handled specially and is removed from the batch
* before processing! * before processing!
@ -199,18 +199,18 @@ class HTMLPurifier_Config
if (empty($this->serials[$namespace])) { if (empty($this->serials[$namespace])) {
$batch = $this->getBatch($namespace); $batch = $this->getBatch($namespace);
unset($batch['DefinitionRev']); unset($batch['DefinitionRev']);
$this->serials[$namespace] = md5(serialize($batch)); $this->serials[$namespace] = sha1(serialize($batch));
} }
return $this->serials[$namespace]; return $this->serials[$namespace];
} }
/** /**
* Returns a md5 signature for the entire configuration object * Returns a SHA-1 signature for the entire configuration object
* that uniquely identifies that particular configuration * that uniquely identifies that particular configuration
*/ */
public function getSerial() { public function getSerial() {
if (empty($this->serial)) { if (empty($this->serial)) {
$this->serial = md5(serialize($this->getAll())); $this->serial = sha1(serialize($this->getAll()));
} }
return $this->serial; return $this->serial;
} }