Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --passcode breaker
- --between 4 - infintity characters
- --base 26 or 36 or 52 or 62
- shell.run("clear")
- local input = io.read()
- --local times = tonumber(input)
- local times = 1
- --local password = "pass"
- local password = input
- local alphabet = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z',}
- local cells = {}
- --len = 5
- --26^(len-1)
- function findLen(times)
- local check = 1
- while true do
- if times <= 26 then
- return check
- elseif 26^(check-1) > times then
- return check-1
- else
- check = check + 1
- end
- end
- end
- --[[
- 500,000
- math.floor --> 500,000 / 26^(5-1) = 1 in 5
- 500,000 % 26^(5-1) = 43,024
- math.floor --> 43,024 / 26^(4-1) = 2 in 4
- 43,024 % 26^(4-1) = 7,872
- math.floor --> 7,872 / 26^(3-1) =
- ]]
- --[[
- 27
- math.floor(27/26^(2-1)) = 1 in 2
- 27 % 26 = 1
- math.floor(1/26^(1-1)) = 1 in 1
- 27 % 1 = 0
- aabb
- ]]
- function cycle2(len,times)
- --len = 3
- --times = 676
- local t = {}
- local rem = times
- dig = 0 --(len)
- while rem ~= 0 do
- t[len-dig] = math.floor(rem/26^(len-1-dig))
- rem = rem % (26^(len-1-dig))
- dig = dig + 1
- end
- return t
- end
- function cycle(len)
- --aaaa aaab aaac aaad aaae
- local string = ""
- for i = 1,len do
- if i == 1 then
- string = alphabet[times%26 + 1]..string
- elseif i == 2 then
- string = alphabet[math.floor(times/26^1) + 1]..string
- elseif i == 3 then
- string = alphabet[math.floor(times/26^2) + 1]..string
- elseif i == 4 then
- string = alphabet[math.floor(times/26^3) + 1]..string
- end
- end
- times = times + 1
- return(string)
- end
- function convToString(table)
- local string = ""
- for i,v in ipairs(table) do
- if v then
- if v == 0 then
- string = string..alphabet[1]
- else
- string = string..alphabet[v]
- end
- end
- end
- return string
- end
- function convToNumber(string)
- local string = string
- local table = {}
- for i = 1, string:len() do
- for k,v in pairs(alphabet) do
- if string:sub(i,i) == v then
- table[i] = k
- end
- end
- end
- return table
- end
- function convToTrueNumber(table)
- local num = 0
- for i,v in ipairs(table) do
- if v then
- num = num + (v * (26^(i-1)))
- end
- end
- return num
- end
- shell.run("clr")
- while true do
- length = findLen(times)
- --length = password:len() --definitely not cheating
- table = cycle2(length,times)
- try = convToString(table)
- term.setCursorPos(1,1)
- term.clearLine()
- print(try)
- if try == password then
- return password, times
- end
- times = times + 1
- sleep(.00001)
- end
- --[[
- local h = fs.open("log",'w')
- local length = findLen(tonumber(input))
- local table = cycle2(length)
- for i,v in ipairs(table) do
- if v then
- h.writeLine(i.." = "..v)
- end
- end
- local convString = convToString(table)
- h.writeLine(nil)
- h.writeLine(convString)
- h.writeLine(nil)
- local convTab = convToNumber(convString)
- h.write(textutils.serialize(convTab))
- h.writeLine(nil)
- h.writeLine(convToTrueNumber(convTab))
- h.close()
- ]]
Add Comment
Please, Sign In to add comment