summaryrefslogtreecommitdiff
path: root/src/blob.c
diff options
context:
space:
mode:
authorTimo Teras <timo.teras@iki.fi>2009-07-14 10:47:20 +0300
committerTimo Teras <timo.teras@iki.fi>2009-07-14 10:47:20 +0300
commitf1985b03bdf77c049cc28b25fe6275867c25ba49 (patch)
tree54951693bad97b824e2a8f4f7fcfbd4727ca9d69 /src/blob.c
parent4562f44f9bac793b8397fdf35491da5d7ef815fa (diff)
downloadapk-tools-f1985b03bdf77c049cc28b25fe6275867c25ba49.tar.gz
apk-tools-f1985b03bdf77c049cc28b25fe6275867c25ba49.tar.bz2
apk-tools-f1985b03bdf77c049cc28b25fe6275867c25ba49.tar.xz
apk-tools-f1985b03bdf77c049cc28b25fe6275867c25ba49.zip
hash: allow caching of hash value
Diffstat (limited to 'src/blob.c')
-rw-r--r--src/blob.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/blob.c b/src/blob.c
index 43c94ea..9f253cb 100644
--- a/src/blob.c
+++ b/src/blob.c
@@ -98,9 +98,9 @@ int apk_blob_split(apk_blob_t blob, apk_blob_t split, apk_blob_t *l, apk_blob_t
}
}
-unsigned long apk_blob_hash(apk_blob_t blob)
+unsigned long apk_blob_hash_seed(apk_blob_t blob, unsigned long seed)
{
- unsigned long hash = 5381;
+ unsigned long hash = seed;
int i;
for (i = 0; i < blob.len; i++)
@@ -109,6 +109,11 @@ unsigned long apk_blob_hash(apk_blob_t blob)
return hash;
}
+unsigned long apk_blob_hash(apk_blob_t blob)
+{
+ return apk_blob_hash_seed(blob, 5381);
+}
+
int apk_blob_compare(apk_blob_t a, apk_blob_t b)
{
if (a.len == b.len)