mirror of
https://github.com/anatolykopyl/know-own-checksum.git
synced 2026-03-26 12:55:27 +00:00
Initial commit
This commit is contained in:
30
brute_md5.lua
Normal file
30
brute_md5.lua
Normal file
@@ -0,0 +1,30 @@
|
||||
-- This approach will take something septillion years
|
||||
|
||||
local md5 = require 'md5'
|
||||
|
||||
function edit_file(input_file, line, content)
|
||||
local file = io.open(input_file, 'r')
|
||||
local file_content = {}
|
||||
for line in file:lines() do
|
||||
table.insert(file_content, line)
|
||||
end
|
||||
io.close(file)
|
||||
|
||||
file_content[line] = content
|
||||
|
||||
file = io.open(input_file, 'w')
|
||||
for index, value in ipairs(file_content) do
|
||||
file:write(value..'\n')
|
||||
end
|
||||
io.close(file)
|
||||
end
|
||||
|
||||
local attempts = 0
|
||||
|
||||
repeat
|
||||
local random_md5 = md5.sumhexa(attempts)
|
||||
edit_file('i_know_my_md5.lua', 13, "local md5_expected = '" .. random_md5 .. "'")
|
||||
local match = require('i_know_my_md5')
|
||||
attempts = attempts + 1
|
||||
print(attempts)
|
||||
until(match)
|
||||
Reference in New Issue
Block a user