From 189e87ac752b356e5ae091fe75d394c0a9573308 Mon Sep 17 00:00:00 2001 From: "Kyle J. McKay" Date: Sat, 7 Jan 2017 17:11:57 -0800 Subject: [PATCH] Markdown.pl: output deterministic documents Obscuring email addresses is all very nice, but outputting a different document every time for the same input is not. It screws up caching and last modified checks and is a very bad thing to do. Instead continue to obscure email addresses, but arrange for the same obscurity to be used when the same input file is processed repeatedly by Markdown.pl on the same machine. Signed-off-by: Kyle J. McKay --- Markdown.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Markdown.pl b/Markdown.pl index a062028..fc0b23e 100755 --- a/Markdown.pl +++ b/Markdown.pl @@ -29,7 +29,7 @@ All rights reserved. close(DATA) if fileno(DATA); require Exporter; -use Digest::MD5 qw(md5_hex); +use Digest::MD5 qw(md5 md5_hex); use File::Basename qw(basename); use Pod::Usage; @ISA = qw(Exporter); @@ -1336,7 +1336,7 @@ sub _EncodeEmailAddress { $prefix = "" unless defined($prefix); $suffix = "" unless defined($suffix); - srand; + srand(unpack('N',md5($addr))); my @encode = ( sub { '&#' . ord(shift) . ';' }, sub { '&#x' . sprintf( "%X", ord(shift) ) . ';' },