+char *pkg_get_md5(const pkg_t *pkg)
+{
+ char *p = pkg_get_raw(pkg, PKG_MD5SUM);
+
+ if (!p)
+ return NULL;
+
+ return checksum_bin2hex(p, 16);
+}
+
+char *pkg_set_md5(pkg_t *pkg, const char *cksum)
+{
+ size_t len;
+ char *p = checksum_hex2bin(cksum, &len);
+
+ if (!p || len != 16)
+ return NULL;
+
+ return pkg_set_raw(pkg, PKG_MD5SUM, p, len);
+}
+
+char *pkg_get_sha256(const pkg_t *pkg)
+{
+ char *p = pkg_get_raw(pkg, PKG_SHA256SUM);
+
+ if (!p)
+ return NULL;
+
+ return checksum_bin2hex(p, 32);
+}
+
+char *pkg_set_sha256(pkg_t *pkg, const char *cksum)
+{
+ size_t len;
+ char *p = checksum_hex2bin(cksum, &len);
+
+ if (!p || len != 32)
+ return NULL;
+
+ return pkg_set_raw(pkg, PKG_SHA256SUM, p, len);
+}
+