From 2eee005702d1be7e0391399f203cdbd9d7d5a42a Mon Sep 17 00:00:00 2001 From: Aki Date: Thu, 7 Nov 2024 18:28:16 +0100 Subject: Sketch of Patrick's simplified automaton/cipher mechanism Document: https://docs.google.com/document/d/1EwnCgP4eq1g_M2iZObSDZdhV3fFoZ0RXRBXWrUm-hw0 Discord: https://discord.com/channels/453998283174576133/1063583558154854521/1303784643342106645 --- machine.lua | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100755 machine.lua (limited to 'machine.lua') diff --git a/machine.lua b/machine.lua new file mode 100755 index 0000000..44f7146 --- /dev/null +++ b/machine.lua @@ -0,0 +1,16 @@ +#!/usr/bin/env lua +local eyes = require "eyes" +local reading = require "reading" +for _, message in ipairs(eyes) do + local cip = require"automaton""abcdefghijklm opqrstuvxyz" + local str = "" + for index, a, b, c in reading.trigrams(message) do + cip = cip:apply(a):apply(b):apply(c) + local slot = 3 + if (index - 1) % 3 == 1 then + slot = 19 + end + str = str .. cip[slot] + end + print(str) +end -- cgit v1.1