diff options
Diffstat (limited to 'disk-simple-mask.lua')
-rwxr-xr-x | disk-simple-mask.lua | 27 |
1 files changed, 27 insertions, 0 deletions
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 |