[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

@@ -5,7 +5,7 @@ A global LRU cache
local DataStorage = require("datastorage")
local lfs = require("libs/libkoreader-lfs")
local logger = require("logger")
local md5 = require("ffi/MD5")
local md5 = require("ffi/sha2").md5
local CanvasContext = require("document/canvascontext")
if CanvasContext.should_restrict_JIT then
@@ -129,7 +129,7 @@ function Cache:check(key, ItemClass)
end
return self.cache[key]
elseif ItemClass then
local cached = self.cached[md5.sum(key)]
local cached = self.cached[md5(key)]
if cached then
local item = ItemClass:new{}
local ok, msg = pcall(item.load, item, cached)
@@ -166,7 +166,7 @@ function Cache:serialize()
-- only dump cache item that requests serialization explicitly
if cache_item.persistent and cache_item.dump then
local cache_full_path = cache_path..md5.sum(key)
local cache_full_path = cache_path..md5(key)
local cache_file_exists = lfs.attributes(cache_full_path)
if cache_file_exists then break end