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 48fc715c22b3811eb089347444a60ec4c74d79d7..3fbf47b928e583ded63aee5cf3c01fe38a36ab1d 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 1bfe1b292466b6c3f8d81ac78b48d8b952f6eee8..77bc4ce71b54a1499c60cb45fba6b6f7de2b9d86 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 a7962f5ade1b2731237fb7a69e4e73bdc83b2923..d96c7349b148433256b96ee47708fe883bdc383d 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 */