-
Notifications
You must be signed in to change notification settings - Fork 5
/
index.html
83 lines (70 loc) · 2.77 KB
/
index.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
77
78
79
80
81
82
83
<!doctype html>
<html>
<head>
<title>Chess Steganography</title>
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
</head>
<body>
<div class="container">
<h1>Chess Steganography</h1>
<p>(See also <a href="oneside.html">the one-sided mode</a>, for when you only control one side's moves).</p>
<p>This is a tool to encode/decode data in chess games. It first encodes the input data as a bignum, and then encodes the bignum in the move choices in the chess game. The "without blunders" mode uses <a href="https://github.com/douglasbagnall/p4wn">p4wn</a> to try to avoid playing bad moves. This mode is less likely to arouse suspicion among actual chess players, but results in longer games.</p>
<p>See <a href="https://incoherency.co.uk/blog/stories/chess-steg.html">my blog post</a> for more information. Also
check out <a href="https://github.com/Alheimsins/chess-steg-cli">Jonas Enge's CLI implementation</a>.</p>
<span style="color:red; display:none" id="error">Error: invalid input</span>
<div class="row">
<div class="col-md-6">
<button class="btn btn-primary" id="steg">Steg »</button>
<button class="btn btn-primary" id="stegb">Steg without blunders »</button>
<textarea rows="6" class="form-control" id="data" placeholder="Data..."></textarea>
</div>
<div class="col-md-6">
<button class="btn btn-primary" id="unsteg">Unsteg «</button>
<button class="btn btn-primary" id="unstegb">Unsteg without blunders «</button>
<form target="_blank" action="https://lichess.org/import" method="POST">
<textarea rows="6" class="form-control" id="pgn" name="pgn" placeholder="Chess game PGN..."></textarea>
<button class="btn btn-primary" type="submit">View on lichess »</button>
</form>
</div>
</div>
<i>By <a href="https://incoherency.co.uk/">James Stanley</a>.</i><br>
<i>Source <a href="https://github.com/jes/chess-steg">on github</a>.</i>
</div>
<script src="js/jquery-3.3.1.min.js"></script>
<script src="js/chess.js"></script>
<script src="js/BigInteger.min.js"></script>
<script src="js/engine.js"></script>
<script src="js/chess-steg.js"></script>
<script type="text/javascript">
function trycatch(f) {
$('#error').hide();
try {
f();
} catch (e) {
$('#error').show();
console.log(e.toString());
}
}
$('#steg').click(function() {
trycatch(function() {
$('#pgn').val(chess_steg($('#data').val()));
});
});
$('#stegb').click(function() {
trycatch(function() {
$('#pgn').val(chess_steg($('#data').val(), true));
});
});
$('#unsteg').click(function() {
trycatch(function() {
$('#data').val(chess_unsteg($('#pgn').val()));
});
});
$('#unstegb').click(function() {
trycatch(function() {
$('#data').val(chess_unsteg($('#pgn').val(), true));
});
});
</script>
</body>
</html>