The file contains integers in decimal form. Convert each number to binary form. Encrypt data in such a way that every eight binary characters turn into a letter of the Latin alphabet. The table of correspondence of codes to letters is contained in the second file. Provide a function to perform the decryption.
If the file should store a table of correspondence of numbers to letters, for example
11001100 A 11010111 B 11110101 C
how do i put them in the table in the program
{ ['10010011']='A', ['10110000']='B', ... }
what would then compare them with the already existing numbers, and subsequently replace the number with a letter?
function tobin(num) local tmp = {} repeat tmp[#tmp+1]=num%2 num = math.floor(num/2) until num==0 return table.concat(tmp):reverse() end local function main() io.input("number.txt") while true do local val = io.read("*number") if val == nil then break end local a = {} a = tobin(val) print(tostring(a)) end ...... end main()