checksum: Set SHA to be the same as SHA1 (For compatibility with original Createrepo)
authorTomas Mlcoch <tmlcoch@redhat.com>
Wed, 14 Aug 2013 08:27:02 +0000 (10:27 +0200)
committerTomas Mlcoch <tmlcoch@redhat.com>
Wed, 14 Aug 2013 08:27:02 +0000 (10:27 +0200)
README.md
src/checksum.c
src/checksum.h

index 48fc715..3fbf47b 100644 (file)
--- a/README.md
+++ b/README.md
@@ -80,6 +80,11 @@ Note: The C tests have to be builded by ``make tests``)!
 
 [Bugzilla](https://bugzilla.redhat.com/buglist.cgi?bug_status=NEW&bug_status=ASSIGNED&bug_status=MODIFIED&bug_status=VERIFIED&component=createrepo_c&query_format=advanced)
 
+### Important notes
+
+In original createrepo ``sha`` is a nickname for the ``sha1`` checksum.
+Createrepo_c mimics this behaviour.
+
 ---------------------------------------------------
 
 # Differences in behavior between createrepo_c and createrepo
index 1bfe1b2..77bc4ce 100644 (file)
@@ -123,7 +123,7 @@ cr_checksum_file(const char *filename,
     switch (type) {
         //case CR_CHECKSUM_MD2:    ctx_type = EVP_md2();    break;
         case CR_CHECKSUM_MD5:    ctx_type = EVP_md5();    break;
-        case CR_CHECKSUM_SHA:    ctx_type = EVP_sha();    break;
+        case CR_CHECKSUM_SHA:    ctx_type = EVP_sha1();   break;
         case CR_CHECKSUM_SHA1:   ctx_type = EVP_sha1();   break;
         case CR_CHECKSUM_SHA224: ctx_type = EVP_sha224(); break;
         case CR_CHECKSUM_SHA256: ctx_type = EVP_sha256(); break;
@@ -189,7 +189,7 @@ cr_checksum_new(cr_ChecksumType type, GError **err)
     switch (type) {
         //case CR_CHECKSUM_MD2:    ctx_type = EVP_md2();    break;
         case CR_CHECKSUM_MD5:    ctx_type = EVP_md5();    break;
-        case CR_CHECKSUM_SHA:    ctx_type = EVP_sha();    break;
+        case CR_CHECKSUM_SHA:    ctx_type = EVP_sha1();   break;
         case CR_CHECKSUM_SHA1:   ctx_type = EVP_sha1();   break;
         case CR_CHECKSUM_SHA224: ctx_type = EVP_sha224(); break;
         case CR_CHECKSUM_SHA256: ctx_type = EVP_sha256(); break;
index a7962f5..d96c734 100644 (file)
@@ -35,6 +35,8 @@ typedef struct _cr_ChecksumCtx cr_ChecksumCtx;
 
 /**
  * Enum of supported checksum types.
+ * Note: SHA is just a "nickname" for the SHA1. This
+ * is for the compatibility with original createrepo.
  */
 typedef enum {
     CR_CHECKSUM_UNKNOWN,    /*!< Unknown checksum */