work on ternary encode function

This commit is contained in:
Kevin Froman 2021-02-14 07:07:09 +00:00
parent 7110f986c0
commit b0a60573f9
3 changed files with 83 additions and 10 deletions

View File

@ -1,22 +1,52 @@
<!doctype html>
<html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>❄️</text></svg>">
<link rel="stylesheet" href="theme.css">
<script src="main.js" defer></script>
</head>
<body>
<div class="container main">
<h1>Snow10 ☃</h1>
<p>Snow10 is a simple web app for converting text to whitespace characters, which can be hidden in normal messages.</p>
<p>It is inspired by the <a href="https://web.archive.org/web/20210117115615/http://darkside.com.au/snow/">original program</a> published in ~1998.</p>
<p>Do not use alongside languages/emoji that use zero-width characters. Sorry, it's the way it works.</p>
<pre>
Threat model: person visually looking at message threads in an app such as Twitter, Matrix, Signal, documents, etc. E.g. abusive family
Encrypt the secret message using something like age or keybase before using if encryption is needed.
Will not resist forensic analysis.
Privacy: This works client-side and does not log any messages.
</pre>
<label>
<input type="radio" name="hideMode" value="hide" checked>
Hide mode
</label>
<label>
<input type="radio" name="hideMode" value="hide">
Unhide mode
</label>
<form class="encode">
<label for="hideText">Non-secret message: <input type="text" name="hideText"></label>
<label for="hideText">Non-secret message: <input type="text" name="hideText" placeholder="Wonderful weather we're having"></label>
<br>
<h1>Secret message</h1>
<textarea name="input" required></textarea>
<textarea name="inputSecret" placeholder="Secret to hide" required></textarea>
<h1>Output</h1>
<textarea name="output" readonly></textarea>
<input type="button" value="Hide - Unhide">
<input type="submit" value="Hide">
</form>
<form class="decode">
<h1>Message containing secret</h1>
<textarea name="input" placeholder="Non-secret message with secret inside" required></textarea>
<h1>Output</h1>
<textarea name="output" readonly></textarea>
<input type="submit" value="Hide">
</form>
</div>
</body>

30
main.ts
View File

@ -15,3 +15,33 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
(
function(){
var characterSet = ['', '<27>', ""]
let encodeForm = document.getElementsByTagName("form")[0]
encodeForm.onsubmit = function(e){
let msg: HTMLTextAreaElement = document.getElementsByTagName('textarea')[0]
let msgText: string = msg.value;
let encoded = new Uint16Array(msgText.length)
for (let i = 0; i < msgText.length; i++){
encoded[i] = msgText.charCodeAt(i)
}
console.debug(encoded)
return false
}
}()
)

View File

@ -24,7 +24,12 @@ textarea{
height: 10em;
}
input[type="button"]{
.encode{
margin-top: 2em;
display: block;
}
input[type="submit"]{
display: block;
margin-top: 2em;
}
@ -36,13 +41,14 @@ input[type="button"]{
}
}
input[type="button"] {
input[type="submit"] {
margin-top: 5em;
box-shadow:inset 0px 1px 3px 0px #91b8b3;
background:linear-gradient(to bottom, #768d87 5%, #6c7c7c 100%);
background-color:#768d87;
border-radius:5px;
border:1px solid #566963;
display:inline-block;
display:block;
cursor:pointer;
color:#ffffff;
font-family:Arial;
@ -52,13 +58,20 @@ input[type="button"]{
text-decoration:none;
text-shadow:0px -1px 0px #2b665e;
}
input[type="button"]:hover {
input[type="submit"]:hover {
background:linear-gradient(to bottom, #6c7c7c 5%, #768d87 100%);
background-color:#6c7c7c;
}
input[type="button"]:active {
input[type="submit"]:active {
position:relative;
top:1px;
}
.container{
margin-left: 2em;
}
.decode{
display: none;
}