From 0b0e02875dbc4d7d795cafe6e5720aa66b32e1ac Mon Sep 17 00:00:00 2001 From: Aki Date: Sat, 2 Nov 2024 13:41:36 +0100 Subject: Naive approach to disk-based masking directly on the trigrams --- disk-simple-mask.lua | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100755 disk-simple-mask.lua (limited to 'disk-simple-mask.lua') diff --git a/disk-simple-mask.lua b/disk-simple-mask.lua new file mode 100755 index 0000000..ba41f7b --- /dev/null +++ b/disk-simple-mask.lua @@ -0,0 +1,27 @@ +#!/usr/bin/env lua +local disk = require "disk" +local eyes = require "eyes" +local format = require "format" +local reading = require "reading" + + +local function mask (ring, index, value) + local offset = (index - 1) % #ring + if ring[offset + 1] == 0 then + return value + else + return 0 + end +end + + +for _, message in ipairs(eyes) do + local values = {} + for index, a, b, c in reading.trigrams(message) do + a = mask(disk.eyes1, index, a) + b = mask(disk.eyes2, index, b) + c = mask(disk.eyes3, index, c) + table.insert(values, reading.trigram_to_value(a, b, c)) + end + print(format.ascii32(values)) +end -- cgit v1.1