[chore] Update MD5 calls with new sha2 library (#6411)

Depends on <https://github.com/koreader/koreader-base/pull/1149>.
This commit is contained in:
Frans de Jonge
2020-07-21 23:25:46 +02:00
committed by GitHub
parent fca7f9e7d5
commit da507f8607
6 changed files with 17 additions and 17 deletions

View File

@@ -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