From 1e54b3cf486cf942ecb32e294e8cde1c028e4f8b Mon Sep 17 00:00:00 2001 From: gesangtome Date: Tue, 24 Mar 2020 05:47:25 +0800 Subject: [PATCH] releasetools: fix Unicode-objects must be encoded before hashing This error occurs when using 'ota_from_target_files' to make an incremental package. According to the prompt, first encode fp to resolve this error. build/make/tools/releasetools/common.py", line 448, in LoadInfoDict d["avb_salt"] = sha256(fp).hexdigest() TypeError: Unicode-objects must be encoded before hashing Change-Id: I196b3ae37e1fb92be58c48aa8ab0928b6e6aec69 --- tools/releasetools/common.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py index 9f57773ba7..d54689bd2e 100644 --- a/tools/releasetools/common.py +++ b/tools/releasetools/common.py @@ -445,7 +445,7 @@ def makeint(key): elif "ro.build.thumbprint" in build_prop: fp = build_prop["ro.build.thumbprint"] if fp: - d["avb_salt"] = sha256(fp).hexdigest() + d["avb_salt"] = sha256(fp.encode()).hexdigest() return d