+local function dumptofile(results)
+ local sector, blockNo, keyA, keyB,_
+
+ if utils.confirm("Do you wish to save the keys to dumpfile?") then
+ local destination = utils.input("Select a filename to store to", "dumpkeys.bin")
+ local file = io.open(destination, "w")
+ if file == nil then
+ print("Could not write to file ", destination)
+ return
+ end
+
+ local key_a = ""
+ local key_b = ""
+
+ for sector,_ in pairs(results) do
+ blockNo, keyA, keyB = unpack(_)
+ key_a = key_a .. bin.pack("H",keyA);
+ key_b = key_b .. bin.pack("H",keyB);
+ end
+ file:write(key_a)
+ file:write(key_b)
+ file:close()
+ end
+end
+local function printkeys()
+ for i=0,#keys do
+ print(i,keys[i])
+
+ end
+ print ('Number of keys: '..#keys)
+end