Drops old sign check for text content file.

This commit is contained in:
Andrea Mazzoleni 2013-08-20 12:49:31 +02:00
parent ca52ecc4c5
commit 3fc1fd1d65
2 changed files with 2 additions and 196 deletions

80
util.h
View file

@ -506,86 +506,6 @@ uint32_t (*crc32c)(uint32_t crc, const unsigned char* ptr, unsigned size);
*/
void crc32c_init(void);
/****************************************************************************/
/* sax */
/**
* One-at-a-time hash type.
* This is a really fast, but insecure hash.
* This is only *partially* based on the Bob Jenkins one-at-a-time hash.
*/
typedef uint32_t oathash_t;
/**
* Hash a byte.
*/
static inline oathash_t oathash8(oathash_t hash, unsigned char value)
{
hash += value;
hash += hash << 10;
hash ^= hash >> 6;
return hash;
}
/**
* Hash a 32 bits word.
*/
static inline oathash_t oathash32(oathash_t hash, uint32_t value)
{
hash += value;
hash += hash << 10;
hash ^= hash >> 6;
return hash;
}
/**
* Hash a 64 bits word.
* \note Based on one-at-a-time by Bob Jenkins.
*/
static inline oathash_t oathash64(oathash_t hash, uint64_t value)
{
hash += value & 0xFFFFFFFF;
hash += hash << 10;
hash ^= hash >> 6;
hash += value >> 32;
hash += hash << 10;
hash ^= hash >> 6;
return hash;
}
/**
* Hash a string.
*/
static inline oathash_t oathashs(oathash_t hash, const char* value)
{
while (*value) {
hash += *value;
hash += hash << 10;
hash ^= hash >> 6;
++value;
}
return hash;
}
/**
* Hash a range of memory.
* The size must be a 32 bits multiplier.
*/
static inline oathash_t oathashm(oathash_t hash, const unsigned char* value, unsigned size)
{
assert(size % 4 == 0);
size /= 4;
while (size--) {
uint32_t w32 = value[0] | ((unsigned)value[1] << 8) | ((unsigned)value[2] << 16) | ((unsigned)value[3] << 24);
hash += w32;
hash += hash << 10;
hash ^= hash >> 6;
value += 4;
}
return hash;
}
/****************************************************************************/
/* lock */