-
Notifications
You must be signed in to change notification settings - Fork 10
/
secret_post.html
76 lines (65 loc) · 2.64 KB
/
secret_post.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
---
layout: default
---
<article class="post h-entry" itemscope itemtype="http://schema.org/BlogPosting">
<header class="post-header">
<h1 class="post-title p-name" itemprop="name headline">{{ page.title | escape }}</h1>
<p class="post-meta">
<time class="dt-published" datetime="{{ page.date | date_to_xmlschema }}" itemprop="datePublished">
{%- assign date_format = site.minima.date_format | default: "%b %-d, %Y" -%}
{{ page.date | date: date_format }}
</time>
{%- if page.author -%}
• <span itemprop="author" itemscope itemtype="http://schema.org/Person"><span class="p-author h-card" itemprop="name">{{ page.author }}</span></span>
{%- endif -%}</p>
</header>
<div class="post-content e-content" itemprop="articleBody">
<div id ="secure-container" style="display: none;">
<div id ="0db9774b86aa5a219a0939cdd5c5aa08">
{{ content }}
</div>
</div>
<div id="decryptor">
This is an active machine - please enter the password to view this content.<br/><br/>
<input id="key" type="text" value="">
<input id="decrypt" type="button" value="Decrypt">
</div>
</div>
{%- if site.disqus.shortname -%}
{%- include disqus_comments.html -%}
{%- endif -%}
<a class="u-url" href="{{ page.url | relative_url }}" hidden></a>
</article>
<!-- post decryption -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script type="text/javascript" src="https://cdn.rawgit.com/ricmoo/aes-js/e27b99df/index.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-sha256/0.9.0/sha256.js"></script>
<script>
var storedEncrypted = '';
function decrypt(key) {
var text = storedEncrypted;
var keyArray = sha256.update(key + _gj.salt).array();
var iv = aesjs.utils.hex.toBytes(_gj.iv);
var encryptedBytes = aesjs.utils.hex.toBytes(text);
var aesCbc = new aesjs.ModeOfOperation.cbc(keyArray, iv);
var decryptedBytes = aesCbc.decrypt(encryptedBytes);
var final = aesjs.utils.utf8.fromBytes(decryptedBytes);
if (final.includes("0db9774b86aa5a219a0939cdd5c5aa08")){
var text = $($.parseHTML(final)).filter('#0db9774b86aa5a219a0939cdd5c5aa08').html();
$('#secure-container').html(text);
$('#secure-container').show();
$('#decryptor').hide();
}else{
// invalid key
}
}
$(document).ready(function() {
$( "#decrypt" ).click(function() {
storedEncrypted = $('#secure-container').text().trim();
key = $('#key').val();
decrypt(key);
});
});
</script>
<div id="crypt_params"></div>
<!-- end of post decryption -->