diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2016-03-22 15:00:52 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2016-03-22 15:00:52 +0100 |
commit | 72583e54cb3823e2d86f0d80d7cc587f102e62ec (patch) | |
tree | 59ac8e2a88c7dbc9c708ce9d388eae468a146ca8 /core/src/ch/asynk/rustanddust/util | |
parent | 83a4f28b17cae4f50f1cb08c6c0fb48749a5926d (diff) | |
download | RustAndDust-72583e54cb3823e2d86f0d80d7cc587f102e62ec.zip RustAndDust-72583e54cb3823e2d86f0d80d7cc587f102e62ec.tar.gz |
DB: add checkDigest(...)
Diffstat (limited to 'core/src/ch/asynk/rustanddust/util')
-rw-r--r-- | core/src/ch/asynk/rustanddust/util/DB.java | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/core/src/ch/asynk/rustanddust/util/DB.java b/core/src/ch/asynk/rustanddust/util/DB.java index 18ee162..df2a64c 100644 --- a/core/src/ch/asynk/rustanddust/util/DB.java +++ b/core/src/ch/asynk/rustanddust/util/DB.java @@ -121,6 +121,14 @@ public class DB return hash; } + private boolean checkDigest(String what, int id, String payload, String digest) + { + if (digest.equals(getDigest(payload))) + return true; + RustAndDust.error(String.format("corrupted %s(%d)", what, id)); + return false; + } + private static final String CHECK_VERSION = "select (value=%d) from config where key='version';"; public Boolean checkVersion() |