Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/lua
- --
- -- password checker
- --
- function fa( x )
- return ((x + 3141592653))
- end
- function fb( x )
- return ((3*x + 1732050808))
- end
- function fc( x )
- return ((5*x + 2236067977))
- end
- function fd( x )
- return ((7*x + 2645751311))
- end
- function check( input )
- local t = {}
- local fl = {}
- local len = string.len(input)
- local res = true
- print("Let me check your password...")
- if len ~= 16 then
- print("Nope...")
- return
- end
- fl[1] = fa
- fl[2] = fb
- fl[3] = fc
- fl[4] = fd
- for i = 0,3 do
- t[i+1] = 16777216*string.byte(input, 4*i+1)
- t[i+1] = t[i+1] + 65536*string.byte(input, 4*i+2)
- t[i+1] = t[i+1] + 256*string.byte(input, 4*i+3)
- t[i+1] = t[i+1] + string.byte(input, 4*i+4)
- end
- for j = 1,10000000 do
- for i = 1, #t do
- local fi = fl[(t[i] % 4)+1]
- t[i] = fi(t[i]) % 4294967296
- end
- end
- if t[1] ~= 2066590424 then
- res = false
- end
- if t[2] ~= 4241186467 then
- res = false
- end
- if t[3] ~= 2486763883 then
- res = false
- end
- if t[4] ~= 2743090029 then
- res = false
- end
- if res == true then
- print("Congratulations!")
- else
- print("Nope...")
- end
- end
- --
- -- Main program
- --
- io.write("Please enter the password: ")
- io.flush()
- pwd = io.read()
- check( pwd )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement