mirror of
https://github.com/anatolykopyl/know-own-checksum.git
synced 2026-03-26 12:55:27 +00:00
20 lines
450 B
Lua
20 lines
450 B
Lua
local md5 = require 'md5'
|
|
local this_file = 'i_know_my_md5.lua'
|
|
|
|
function read_all(file)
|
|
local f = assert(io.open(file, "rb"))
|
|
local content = f:read("*all")
|
|
f:close()
|
|
return content
|
|
end
|
|
|
|
local content = read_all(this_file)
|
|
local md5_result = md5.sumhexa(content)
|
|
local md5_expected = ''
|
|
|
|
print('My expected md5 checksum is ' .. md5_expected)
|
|
print('My own md5 checksum is ' .. md5_result)
|
|
|
|
local match = md5_result == md5_expected
|
|
return match
|