Allow SKEIN to be used as a Global Dedupe chunk lookup hash.

This commit is contained in:
Moinak Ghosh 2013-05-04 15:59:29 +05:30
parent 0cf94c308a
commit c6da2325e3
3 changed files with 20 additions and 3 deletions

View file

@ -128,6 +128,12 @@ get_cksum_type(char *cksum_name)
} else if (strcmp(cksum_name, "KECCAK512") == 0) { } else if (strcmp(cksum_name, "KECCAK512") == 0) {
return (CKSUM_KECCAK512); return (CKSUM_KECCAK512);
} else if (strcmp(cksum_name, "SKEIN256") == 0) {
return (CKSUM_SKEIN256);
} else if (strcmp(cksum_name, "SKEIN512") == 0) {
return (CKSUM_SKEIN512);
} }
return (CKSUM_INVALID); return (CKSUM_INVALID);
} }
@ -155,6 +161,12 @@ get_cksum_str(cksum_t ck)
} else if (ck == CKSUM_KECCAK512) { } else if (ck == CKSUM_KECCAK512) {
return ("KECCAK512"); return ("KECCAK512");
} else if (ck == CKSUM_SKEIN256) {
return ("SKEIN256");
} else if (ck == CKSUM_SKEIN512) {
return ("SKEIN512");
} }
return ("INVALID"); return ("INVALID");
} }
@ -165,10 +177,12 @@ get_cksum_sz(cksum_t ck)
if (ck == CKSUM_CRC64) { if (ck == CKSUM_CRC64) {
return (8); return (8);
} else if (ck == CKSUM_SHA256 || ck == CKSUM_BLAKE256 || ck == CKSUM_KECCAK256) { } else if (ck == CKSUM_SHA256 || ck == CKSUM_BLAKE256 || ck == CKSUM_KECCAK256 ||
ck == CKSUM_SKEIN256) {
return (32); return (32);
} else if (ck == CKSUM_SHA512 || ck == CKSUM_BLAKE512 || ck == CKSUM_KECCAK512) { } else if (ck == CKSUM_SHA512 || ck == CKSUM_BLAKE512 || ck == CKSUM_KECCAK512 ||
ck == CKSUM_SKEIN512) {
return (64); return (64);
} }
return (0); return (0);

View file

@ -221,7 +221,7 @@ create_dedupe_context(uint64_t chunksize, uint64_t real_chunksize, int rab_blk_s
chunk_cksum = 0; chunk_cksum = 0;
if ((ck = getenv("PCOMPRESS_CHUNK_HASH_GLOBAL")) != NULL) { if ((ck = getenv("PCOMPRESS_CHUNK_HASH_GLOBAL")) != NULL) {
if (get_checksum_props(ck, &chunk_cksum, &cksum_bytes, &mac_bytes, 0) != 0 || if (get_checksum_props(ck, &chunk_cksum, &cksum_bytes, &mac_bytes, 1) != 0 ||
strcmp(ck, "CRC64") == 0) { strcmp(ck, "CRC64") == 0) {
fprintf(stderr, "Invalid PCOMPRESS_CHUNK_HASH_GLOBAL. Reverting to default.\n"); fprintf(stderr, "Invalid PCOMPRESS_CHUNK_HASH_GLOBAL. Reverting to default.\n");
chunk_cksum = -1; chunk_cksum = -1;

View file

@ -160,6 +160,9 @@ typedef enum {
* Backwards compatibility options. SKEIN in release 1.2 was replaced with * Backwards compatibility options. SKEIN in release 1.2 was replaced with
* Blake2 from 1.3 onwards (for sheer speed of Blake2). We want to be able * Blake2 from 1.3 onwards (for sheer speed of Blake2). We want to be able
* to decode archives created with 1.2. New archives do not use SKEIN. * to decode archives created with 1.2. New archives do not use SKEIN.
*
* However SKEIN can be used as a chunk/block hash for Global Deduplication.
* So it will not be removed.
*/ */
CKSUM_SKEIN256 = 0x800, CKSUM_SKEIN256 = 0x800,
CKSUM_SKEIN512 = 0x900, CKSUM_SKEIN512 = 0x900,