本文整理汇总了C++中calcHash函数的典型用法代码示例。如果您正苦于以下问题:C++ calcHash函数的具体用法?C++ calcHash怎么用?C++ calcHash使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了calcHash函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: load
void load(uint32 offset) {
byte *item = getData(offset);
id = offset;
// Only save the hashes instead of the full names
bgFilename1 = calcHash(getStringP(READ_LE_UINT32(item + 0)));
bgFilename2 = calcHash(getStringP(READ_LE_UINT32(item + 4)));
txFilename = calcHash(getStringP(READ_LE_UINT32(item + 8)));
bgFilename3 = calcHash(getStringP(READ_LE_UINT32(item + 12)));
xPosIndex = item[16];
count = item[17];
}
示例2: calcHMac
STATIC bool calcHMac(const SecureStorageS *storage, unsigned char *caData) {
unsigned char tmpHash[SHA256_LEN], hash[SHA256_LEN];
int16_t len = 0;
int16_t secretLen = 0;
if (storage == NULL) {
assert(LIB_NAME "Storage structure must not be NULL" && (false || Storage_TestMode));
return false;
}
memset(hash, 0, SHA256_LEN);
calcHash(storage, hash);
if (SECURE_DEBUG) {
Utils_PrintHexStr(stderr, "Base hash:", hash, SHA256_LEN);
}
Utils_GetCharArrayLen(storage->caSalt, &len, MIN_SALT_LEN, KEY_VAL_MAX_STR_LEN);
if (Utils_GetCharArrayLen(storage->caSecret, &secretLen, KEY_VAL_MIN_STR_LEN, KEY_VAL_MAX_STR_LEN) == false) {
return false;
}
if (Crypto_CalcHmac(&(storage->caSecret[UTILS_STR_LEN_SIZE]), secretLen, storage->caSalt, len + UTILS_STR_LEN_SIZE, tmpHash) == false)
return false;
calcHashXor(hash, tmpHash, SHA256_LEN);
memcpy(caData + UTILS_STR_LEN_SIZE, hash, SHA256_LEN);
Utils_SetCharArrayLen(caData, SHA256_LEN);
caData[SIGN_LEN] = 0;
return true;
}
示例3: arrayAtIdentityHashInPairs
int arrayAtIdentityHashInPairs(PyrObject *array, PyrSlot *key)
{
PyrSlot *slots, *test;
unsigned int i, start, end, hash, maxHash;
hash = calcHash(key);
maxHash = array->size >> 1;
start = (hash % maxHash) << 1;
end = array->size;
slots = array->slots;
for (i=start; i<end; i+=2) {
test = slots + i;
if (IsNil(test) || (test->utag == key->utag && test->ui == key->ui)) {
return i;
}
}
end = start - 2;
for (i=0; i<=end; i+=2) {
test = slots + i;
if (IsNil(test) || (test->utag == key->utag && test->ui == key->ui)) {
return i;
}
}
return -2;
}
示例4: Entity
Palette::Palette(NeverhoodEngine *vm, const char *filename) : Entity(vm, 0) {
PaletteResource paletteResource(_vm);
init();
paletteResource.load(calcHash(filename));
paletteResource.copyPalette(_palette);
SetUpdateHandler(&Palette::update);
}
示例5: startAnimation
void AsScene1308JaggyDoor::stCloseDoor() {
startAnimation(0xBA0AE050, -1, -1);
_playBackwards = true;
setVisible(true);
playSound(0, calcHash("fxDoorClose38"));
NextState(&AsScene1308JaggyDoor::stCloseDoorDone);
}
示例6: find
long find(float * const &vertex, const unsigned int &size, float * const &vertices, unsigned int * const &hashes, const unsigned int &count) {
const unsigned int hash = calcHash(vertex, size);
for (unsigned int i = 0; i < count; i++)
if (hashes[i] == hash && compare(&vertices[i*size], vertex, size))
return (long)i;
return -1;
}
示例7: insert
void insert(IntHashMap* m, int32_t value, u_int64_t count)
{
u_int32_t hash = calcHash(m->module, value);
u_int32_t c;
u_int32_t h = hash;
for(c = 0; c < m->maxDups; c++, h += m->module)
{
if(m->hash2count[h] == 0)
{
if(c == 0)
{
m->idx2hash[m->numPlaces] = hash;
m->numPlaces++;
}
m->numEntries++;
m->hash2value[h] = value;
}
if(m->hash2value[h] == value)
{
m->hash2count[h] += count;
return;
}
}
int x = 3;
int y = 0;
printf("%d\n", x/y);
err(-1, "No more places left to store inserted value %d with hash %d!\n", value, hash);
}
示例8: calcHash
StringValue *StringTable::lookup(const char *s, size_t length)
{
const hash_t hash = calcHash(s, length);
const size_t i = findSlot(hash, s, length);
// printf("lookup %.*s %p\n", (int)length, s, table[i].value ?: NULL);
return getValue(table[i].vptr);
}
示例9: imagem
QString BD::calcHash(QString nomeImagem) const
{
QImage imagem(nomeImagem);
if (imagem.isNull())
return QString();
else
return calcHash(imagem);
}
示例10: insertFile
void insertFile(char name[], struct linknode **hashTable)
{
int hash;
char init;
init = name[0];
hash = calcHash(init);
hashTable[hash] = insertNode(hashTable[hash], name);
}
示例11: deleteFile
void deleteFile(char name[], struct linknode **hashTable)
{
int hash;
char init;
init = name[0];
hash = calcHash(init);
hashTable[hash] = deleteNode(hashTable[hash], name);
}
示例12: calcHash
StringEntry *StringEntry::alloc(const char *s, size_t len)
{
StringEntry *se;
se = (StringEntry *) mem.calloc(1,sizeof(StringEntry) + len + 1);
se->value.ctor(s, len);
se->hash = calcHash(s,len);
return se;
}
示例13: run
static void run() {
int lineN;
scanf("%d", &lineN);
for (int line = 0; line < lineN; ++line) {
int command;
int parentId, childId, elementId;
int height, width;
int hash, resultHash;
Element element;
scanf("%d", &command);
switch (command) {
case INIT:
scanf("%d", &expected);
init();
break;
case CREATE:
scanf("%d %d", &elementId, &(element.type));
readElement(&element);
id[elementId] = create(&element);
break;
case ADD:
scanf("%d %d", &parentId, &childId);
add(id[parentId], id[childId]);
break;
case SHOW:
scanf("%d %d %d %d", &elementId, &height, &width, &hash);
show(id[elementId], screen);
resultHash = calcHash(screen, height, width);
#if 0
printf ("Expected W %d H %d\n", width, height);
for (int y = 0; y < height; ++y)
{
for (int x = 0; x < width; ++x)
printf("%c", screen[y][x]);
printf("\n");
}
#endif
if (resultHash == hash)
{
point++;
// printf ("%d \n", point);
}
else
{
printf("FAILED %d %d\n", hash, resultHash);
exit (0);
return;
}
break;
}
}
}
示例14: calcHash
uint Utils::calcHash(const QString &str)
{
if(str.isNull()) // handle null string as "", prevents crash
return calcHash("");
const char *s = str.ascii();
uint hash = 5381;
int c;
while((c = *s++)) hash = ((hash << 5) + hash) + c; // hash*33 + c
return hash;
}
示例15: calcHash
unsigned int DocumentSource::hash() const
{
if (!d->calculatedHash)
{
d->hash = calcHash(d->array);
d->calculatedHash = true;
}
return d->hash;
}