| 
					
				 | 
			
			
				@@ -22,7 +22,7 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	{{ else }} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		{{- $passphrase -}} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	{{ end }} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	<p>{{ i18n "protectedbypwd" }} The password is <code>{{ $.Scratch.Get "passphrase" }}</code>.</p> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	<p>{{ i18n "protectedbypwd" }}</p> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	<div class='hugo-encrypt-form'> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		<input 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -129,16 +129,15 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 					/** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 					* calculate sha1 of decrypted text and check if it 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 					* matches the sha1 at the bottom of the decrypted text 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-					* to get the hash that was added during encryption we 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					* to get the same hash that was added during encryption we 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 					* need to remove the last line 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 					*/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-					var hash = CryptoJS.SHA1(res.replace(/[\w\W]+?\n+?/,"").replace(/\r?\n?[^\r\n]*$/, "")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					var hash = CryptoJS.SHA1(res.replace(/\r?\n?[^\r\n]*$/, "")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 					var result = CryptoJS.enc.Hex.stringify(hash); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 					if ( res.includes(result) ) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 						cipher.parentElement.outerHTML = interpreteMarkdown(res); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 						userStorage.setItem(storageKey, password); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-						document.getElementById("beginProtectedContent").innerHTML = "Beginning of decrypted content"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-						document.getElementById("endProtectedContent").innerHTML = "End of decrypted content"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+						document.getElementById("sha1sum").innerHTML = "sha1: " + result; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 					} else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 						if (type === "input") { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 							alert('{{ i18n "wrongpwd" }}'); 
			 |