当前位置: 首页>>代码示例>>C++>>正文


C++ calcHash函数代码示例

本文整理汇总了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];
	}
开发者ID:MaddTheSane,项目名称:scummvm,代码行数:11,代码来源:create_neverhood.cpp

示例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;
}
开发者ID:ibm-security-innovation,项目名称:libsecurity-c,代码行数:27,代码来源:secureStorage.c

示例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;
}
开发者ID:scztt,项目名称:sc-debug,代码行数:25,代码来源:PyrListPrim.cpp

示例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);
}
开发者ID:jaeyeonkim,项目名称:scummvm-kor,代码行数:7,代码来源:palette.cpp

示例5: startAnimation

void AsScene1308JaggyDoor::stCloseDoor() {
	startAnimation(0xBA0AE050, -1, -1);
	_playBackwards = true;
	setVisible(true);
	playSound(0, calcHash("fxDoorClose38"));
	NextState(&AsScene1308JaggyDoor::stCloseDoorDone);
}
开发者ID:jaeyeonkim,项目名称:scummvm-kor,代码行数:7,代码来源:module1300_sprites.cpp

示例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;
	}
开发者ID:0302zq,项目名称:libgdx,代码行数:7,代码来源:com.badlogic.gdx.utils.BufferUtils.cpp

示例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);
}
开发者ID:schiermike,项目名称:algo_puzzles,代码行数:30,代码来源:abcdef.c

示例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);
}
开发者ID:AlexBezzubenko,项目名称:dmd,代码行数:7,代码来源:stringtable.c

示例9: imagem

QString BD::calcHash(QString nomeImagem) const
{
	QImage imagem(nomeImagem);
	if (imagem.isNull())
		return QString();
	else
		return calcHash(imagem);
}
开发者ID:tureba,项目名称:CBIR,代码行数:8,代码来源:BD.cpp

示例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);
}
开发者ID:sagar13,项目名称:temp,代码行数:8,代码来源:hash.c

示例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);
}
开发者ID:sagar13,项目名称:temp,代码行数:8,代码来源:hash.c

示例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;
}
开发者ID:AlbertLkn,项目名称:dmd,代码行数:9,代码来源:stringtable.c

示例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;
		}
	}
}
开发者ID:rahuljain81,项目名称:Algorithms,代码行数:57,代码来源:Prof_22July_main.cpp

示例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;
}
开发者ID:serghei,项目名称:kde3-kdepim,代码行数:10,代码来源:utils.cpp

示例15: calcHash

unsigned int DocumentSource::hash() const
{
    if (!d->calculatedHash)
    {
        d->hash = calcHash(d->array);
        d->calculatedHash = true;
    }
    
    return d->hash;
}
开发者ID:pvuorela,项目名称:kcalcore,代码行数:10,代码来源:documentsource.cpp


注:本文中的calcHash函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。