mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
[chore] Update MD5 calls with new sha2 library (#6411)
Depends on <https://github.com/koreader/koreader-base/pull/1149>.
This commit is contained in:
@@ -135,20 +135,20 @@ function Document:fastDigest(docsettings)
|
||||
if not result then
|
||||
logger.dbg("computing and storing partial_md5_checksum")
|
||||
local bit = require("bit")
|
||||
local md5 = require("ffi/MD5")
|
||||
local md5 = require("ffi/sha2").md5
|
||||
local lshift = bit.lshift
|
||||
local step, size = 1024, 1024
|
||||
local m = md5.new()
|
||||
local update = md5()
|
||||
for i = -1, 10 do
|
||||
file:seek("set", lshift(step, 2*i))
|
||||
local sample = file:read(size)
|
||||
if sample then
|
||||
m:update(sample)
|
||||
update(sample)
|
||||
else
|
||||
break
|
||||
end
|
||||
end
|
||||
result = m:sum()
|
||||
result = update()
|
||||
docsettings:saveSetting("partial_md5_checksum", result)
|
||||
end
|
||||
if tmp_docsettings then
|
||||
|
||||
Reference in New Issue
Block a user