SHOW:
|
|
- or go back to the newest paste.
| 1 | rednet.open('right')
| |
| 2 | local deCrypt = {} --do not change
| |
| 3 | ||
| 4 | --change keys here | |
| 5 | local deCrypt1 = 'a' | |
| 6 | local deCrypt2 = 'b' | |
| 7 | -- | |
| 8 | ||
| 9 | for num = 1,#deCrypt1 do | |
| 10 | local v = string.sub(deCrypt1,num,num) | |
| 11 | table.insert(deCrypt,string.byte(v)) | |
| 12 | end | |
| 13 | ||
| 14 | while true do | |
| 15 | repeat | |
| 16 | id,msg,prot = rednet.receive() | |
| 17 | until type(msg) == 'table' | |
| 18 | for i,v in ipairs(msg) do | |
| 19 | if i ~= 1 then | |
| 20 | local num = v | |
| 21 | num = num/os.epoch() | |
| 22 | for i2,v2 in ipairs(deCrypt) do | |
| 23 | if i2%2 == 0 then | |
| 24 | num = num*v2 | |
| 25 | else | |
| 26 | num = num/v2 | |
| 27 | end | |
| 28 | end | |
| 29 | msg[i] = num | |
| 30 | end | |
| 31 | end | |
| 32 | local result = '' | |
| 33 | for i,v in ipairs(msg) do | |
| 34 | if type(v) == 'number' then | |
| 35 | if v <= 255 and v >= 0 then | |
| 36 | result = result..string.char(v) | |
| 37 | end | |
| 38 | end | |
| 39 | end | |
| 40 | print(result) | |
| 41 | if result == deCrypt2 then | |
| 42 | print('accepted')
| |
| 43 | end | |
| 44 | end |