diff options
author | Timo Teras <timo.teras@iki.fi> | 2009-06-28 18:05:17 +0300 |
---|---|---|
committer | Timo Teras <timo.teras@iki.fi> | 2009-06-28 18:52:40 +0300 |
commit | fac4cdb3fad6037e0841724a50d5364d16603f07 (patch) | |
tree | 3d180deab279e6e0046ebba1cdc9a02e97d85516 /src/blob.c | |
parent | 7a29678aac20ac9e113704f8a5743f6051edef8d (diff) | |
download | apk-tools-fac4cdb3fad6037e0841724a50d5364d16603f07.tar.gz apk-tools-fac4cdb3fad6037e0841724a50d5364d16603f07.tar.bz2 apk-tools-fac4cdb3fad6037e0841724a50d5364d16603f07.tar.xz apk-tools-fac4cdb3fad6037e0841724a50d5364d16603f07.zip |
blob: function to checksum a blob
And use it in couple of places. Some whitespace fixes too.
Diffstat (limited to 'src/blob.c')
-rw-r--r-- | src/blob.c | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -4,7 +4,7 @@ * Copyright (C) 2008 Timo Teräs <timo.teras@iki.fi> * All rights reserved. * - * This program is free software; you can redistribute it and/or modify it + * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 as published * by the Free Software Foundation. See http://www.gnu.org/ for details. */ @@ -165,6 +165,15 @@ unsigned apk_blob_uint(apk_blob_t blob, int base) return val; } +void apk_blob_csum(apk_blob_t blob, csum_t csum) +{ + csum_ctx_t ctx; + + csum_init(&ctx); + csum_process(&ctx, blob.ptr, blob.len); + csum_finish(&ctx, csum); +} + int apk_hexdump_parse(apk_blob_t to, apk_blob_t from) { int i; |