예제 #1
0
void Test_HashBoard() {
	std::cout << "**** Test_HashBoard ****" << std::endl;
	std::cout << "Hash1:" << std::endl;
	TEST_HASH_BOARD(Hash1(board));
	TEST_HASH_BOARD(Hash1(board));
	std::cout << "Hash2:" << std::endl;
	TEST_HASH_BOARD(Hash2(board));
	TEST_HASH_BOARD(Hash2(board));
	std::cout << "Hash3:" << std::endl;
	TEST_HASH_BOARD(Hash3(board));
	TEST_HASH_BOARD(Hash3(board));
	std::cout << "----------------------------------------" << std::endl;
}
예제 #2
0
int crypto_hash(
       unsigned char *out,
       const unsigned char *in,
       unsigned long long inlen
     )
{
       if (Hash3(crypto_hash_BYTES * 8,in,inlen * 8,out) == SUCCESS) return 0;
       return -1;
}
예제 #3
0
	void XCTable::Insert(DD A, DD B, DD C, DD tmp)
	{
		if (toAddCount > 0) {
			Expand();
		}
		//-------------------------------------------------------
		int pos = Hash3(A, B, C, shiftSize);
		items[pos].A = A;
		items[pos].B = B;
		items[pos].C = C;
		items[pos].R = tmp;
	}
예제 #4
0
	bool XCTable::Find(DD A, DD B, DD C, DD &r)
	{
		findCount++;
		int pos = Hash3(A, B, C, shiftSize);
		if ((A == items[pos].A) && (B == items[pos].B) && (C == items[pos].C)) {
			foundedCount++;
			r = items[pos].R;
			return true;
		}
		missCount++;
		return false;
	}
예제 #5
0
	void XCTable::Expand(bool isInc)
	{
		int newcount = count << 1;
		if (!isInc) newcount = count >> 1;

		CTableNode *newitems = new CTableNode[newcount];
		int newshiftSize = shiftSize - 1;
		if (!isInc) newshiftSize = shiftSize + 1;

		for (int i = 0; i < count; i++) {
			int pos = Hash3(items[i].A, items[i].B, items[i].C, newshiftSize);
			newitems[pos].A = items[i].A;
			newitems[pos].B = items[i].B;
			newitems[pos].C = items[i].C;
			newitems[pos].R = items[i].R;
		}
		delete[]items;
		items = newitems;
		count = newcount;
		shiftSize = newshiftSize;
		toAddCount = 0;
	}
예제 #6
0
void keccak_regenhash(struct work *work)
{
	uint256 result;
	Hash3(&result, &work->data[0], &work->data[80]);
	memcpy(work->hash, &result, 32);
}