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


C++ NewHash函数代码示例

本文整理汇总了C++中NewHash函数的典型用法代码示例。如果您正苦于以下问题:C++ NewHash函数的具体用法?C++ NewHash怎么用?C++ NewHash使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了NewHash函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Swig_feature_set

void 
Swig_feature_set(Hash *features, String *name, SwigType *decl, String *featurename, DOH *value) {
  Hash *n;
  Hash *fhash;
  /*  Printf(stdout,"feature: %s %s %s %s\n", name, decl, featurename, value);*/

  n = Getattr(features,name);
  if (!n) {
    n = NewHash();
    Setattr(features,name,n);
  }
  if (!decl) {
    fhash = Getattr(n,"*");
    if (!fhash) {
      fhash = NewHash();
      Setattr(n,"*",fhash);
    }
  } else {
    fhash = Getattr(n,decl);
    if (!fhash) {
      fhash = NewHash();
      Setattr(n,Copy(decl),fhash);
    }
  }
  if (value) {
    Setattr(fhash,featurename,value);
  } else {
    Delattr(fhash,featurename);
  }
}
开发者ID:kanbang,项目名称:Colt,代码行数:30,代码来源:naming.c

示例2: DBInitEventQueue

void DBInitEventQueue(void)
{
	pthread_mutex_init(&DBEventQueueMutex, NULL);
	pthread_mutex_init(&DBEventExitQueueMutex, NULL);

	DBQueueEvents = NewHash(1, Flathash);
	DBInboundEventQueues[0] = NewHash(1, Flathash);
	DBInboundEventQueues[1] = NewHash(1, Flathash);
	DBInboundEventQueue = DBInboundEventQueues[0];
}
开发者ID:mingodad,项目名称:citadel,代码行数:10,代码来源:serv_eventclient.c

示例3: defined

DecodingResult OAEP_Base::Unpad(const byte *oaepBlock, size_t oaepBlockLen, byte *output, const NameValuePairs &parameters) const
{
	bool invalid = false;

#if defined(CRYPTOPP_CXX11)
	std::unique_ptr<HashTransformation> pHash(NewHash());
#else
	std::auto_ptr<HashTransformation> pHash(NewHash());
#endif

	// convert from bit length to byte length
	if (oaepBlockLen % 8 != 0)
	{
		invalid = (oaepBlock[0] != 0) || invalid;
		oaepBlock++;
	}
	oaepBlockLen /= 8;

	const size_t hLen = pHash->DigestSize();
	const size_t seedLen = hLen, dbLen = oaepBlockLen-seedLen;

	invalid = (oaepBlockLen < 2*hLen+1) || invalid;

	SecByteBlock t(oaepBlock, oaepBlockLen);
	byte *const maskedSeed = t;
	byte *const maskedDB = t+seedLen;

#if defined(CRYPTOPP_CXX11)
	std::unique_ptr<MaskGeneratingFunction> pMGF(NewMGF());
#else
	std::auto_ptr<MaskGeneratingFunction> pMGF(NewMGF());
#endif

	pMGF->GenerateAndMask(*pHash, maskedSeed, seedLen, maskedDB, dbLen);
	pMGF->GenerateAndMask(*pHash, maskedDB, dbLen, maskedSeed, seedLen);

	ConstByteArrayParameter encodingParameters;
	parameters.GetValue(Name::EncodingParameters(), encodingParameters);

	// DB = pHash' || 00 ... || 01 || M
	byte *M = std::find(maskedDB+hLen, maskedDB+dbLen, 0x01);
	invalid = (M == maskedDB+dbLen) || invalid;
	invalid = (std::find_if(maskedDB+hLen, M, std::bind2nd(std::not_equal_to<byte>(), byte(0))) != M) || invalid;
	invalid = !pHash->VerifyDigest(maskedDB, encodingParameters.begin(), encodingParameters.size()) || invalid;

	if (invalid)
		return DecodingResult();

	M++;
	memcpy(output, M, maskedDB+dbLen-M);
	return DecodingResult(maskedDB+dbLen-M);
}
开发者ID:hovatterz,项目名称:cryptopp,代码行数:52,代码来源:oaep.cpp

示例4: NewHash

void
ServerStartModule_CONTEXT
(void)
{
	long *v;
	HttpReqTypes = NewHash(1, NULL);
	HttpHeaderHandler = NewHash(1, NULL);

	v = malloc(sizeof(long));
	*v = eGET;
	Put(HttpReqTypes, HKEY("GET"), v, NULL);

	v = malloc(sizeof(long));
	*v = ePOST;
	Put(HttpReqTypes, HKEY("POST"), v, NULL);

	v = malloc(sizeof(long));
	*v = eOPTIONS;
	Put(HttpReqTypes, HKEY("OPTIONS"), v, NULL);

	v = malloc(sizeof(long));
	*v = ePROPFIND;
	Put(HttpReqTypes, HKEY("PROPFIND"), v, NULL);

	v = malloc(sizeof(long));
	*v = ePUT;
	Put(HttpReqTypes, HKEY("PUT"), v, NULL);

	v = malloc(sizeof(long));
	*v = eDELETE;
	Put(HttpReqTypes, HKEY("DELETE"), v, NULL);

	v = malloc(sizeof(long));
	*v = eHEAD;
	Put(HttpReqTypes, HKEY("HEAD"), v, NULL);

	v = malloc(sizeof(long));
	*v = eMOVE;
	Put(HttpReqTypes, HKEY("MOVE"), v, NULL);

	v = malloc(sizeof(long));
	*v = eCOPY;
	Put(HttpReqTypes, HKEY("COPY"), v, NULL);

	v = malloc(sizeof(long));
	*v = eREPORT;
	Put(HttpReqTypes, HKEY("REPORT"), v, NULL);
}
开发者ID:henri14,项目名称:citadel,代码行数:48,代码来源:context_loop.c

示例5: SwigType_namestr

String *Swig_name_destroy(const_String_or_char_ptr nspace, const_String_or_char_ptr classname) {
  String *r;
  String *f;
  String *rclassname;
  char *cname;
  rclassname = SwigType_namestr(classname);
  r = NewStringEmpty();
  if (!naming_hash)
    naming_hash = NewHash();
  f = Getattr(naming_hash, "destroy");
  if (!f) {
    Append(r, "delete_%n%c");
  } else {
    Append(r, f);
  }

  cname = Char(rclassname);
  if ((strncmp(cname, "struct ", 7) == 0) || ((strncmp(cname, "class ", 6) == 0)) || ((strncmp(cname, "union ", 6) == 0))) {
    cname = strchr(cname, ' ') + 1;
  }

  replace_nspace(r, nspace);
  Replace(r, "%c", cname, DOH_REPLACE_ANY);
  Delete(rclassname);
  return r;
}
开发者ID:progranism,项目名称:Allegro-5-SWIG-Wrapper,代码行数:26,代码来源:naming.c

示例6: SwigType_namestr

String *Swig_name_disown(const String_or_char *classname) {
  String *r;
  String *f;
  String *rclassname;
  char *cname;
  rclassname = SwigType_namestr(classname);
  r = NewString("");
  if (!naming_hash) naming_hash = NewHash();
  f = Getattr(naming_hash,"disown");
  if (!f) {
    Append(r,"disown_%c");
  } else {
    Append(r,f);
  }

  cname = Char(rclassname);
  if ((strncmp(cname,"struct ", 7) == 0) ||
      ((strncmp(cname,"class ", 6) == 0)) ||
      ((strncmp(cname,"union ", 6) == 0))) {
    cname = strchr(cname, ' ')+1;
  }
  Replace(r,"%c",cname, DOH_REPLACE_ANY);
  Delete(rclassname);
  return r;
}
开发者ID:kanbang,项目名称:Colt,代码行数:25,代码来源:naming.c

示例7: DohSetmeta

int
DohSetmeta(DOH *ho, const DOH *name, const DOH *value) {
  DohBase *h = (DohBase *) ho;
  if (!DohCheck(ho)) return 0;
  if (!h->meta) h->meta = NewHash();
  return DohSetattr(h->meta, name, value);
}
开发者ID:LorenzMeier,项目名称:swig-wx,代码行数:7,代码来源:base.c

示例8: NewHash

SwigType *SwigType_strip_qualifiers(SwigType *t) {
  static Hash *memoize_stripped = 0;
  SwigType *r;
  List *l;
  Iterator ei;

  if (!memoize_stripped)
    memoize_stripped = NewHash();
  r = Getattr(memoize_stripped, t);
  if (r)
    return Copy(r);

  l = SwigType_split(t);
  r = NewStringEmpty();

  for (ei = First(l); ei.item; ei = Next(ei)) {
    if (SwigType_isqualifier(ei.item))
      continue;
    Append(r, ei.item);
  }
  Delete(l);
  {
    String *key, *value;
    key = Copy(t);
    value = Copy(r);
    Setattr(memoize_stripped, key, value);
    Delete(key);
    Delete(value);
  }
  return r;
}
开发者ID:charlie5,项目名称:swig4ada,代码行数:31,代码来源:typeobj.c

示例9: Swig_fragment_register

void
Swig_fragment_register(Node* fragment) {
  if (Getattr(fragment,k_emitonly)) {
    Swig_fragment_emit(fragment);
    return;
  } else {
    String *name = Copy(Getattr(fragment,k_value));
    String *type = Getattr(fragment,k_type);
    if (type) {
      SwigType *rtype = SwigType_typedef_resolve_all(type);
      String *mangle = Swig_string_mangle(type);
      Append(name,mangle);
      Delete(mangle);
      Delete(rtype);
      if (debug) Printf(stdout,"register fragment %s %s\n",name,type);
    }
    if (!fragments) {
      fragments = NewHash();
    }
    if (!Getattr(fragments,name)) {
      String *section = Copy(Getattr(fragment,k_section));
      String *ccode = Copy(Getattr(fragment,k_code));
      Hash *kwargs = Getattr(fragment,k_kwargs);
      Setmeta(ccode,k_section,section);
      if (kwargs) {
	Setmeta(ccode,k_kwargs,kwargs);
      }
      Setattr(fragments,name,ccode);
      if (debug) Printf(stdout,"registering fragment %s %s\n",name,section);
      Delete(section);
      Delete(ccode);
    }
    Delete(name);
  }
}
开发者ID:LorenzMeier,项目名称:swig-wx,代码行数:35,代码来源:fragment.c

示例10: TestHash

void TestHash()
{
	Thing key  = Word(7);
	Thing item = Word(11);
	Thing X, Y;
	CommentLine("Testing Hashtable");
	Hash H = NewHash(NULL);
	
	HashIns(H, key, item);
	//BAD CODE: if (IntWord(HashGet(H, key)) != 11) 
	//{ printf("no match!\n"); }
	//HashGet can return NULL!
	X = HashGet(H, key);	
	assert(X);
	assert(SameThing(X, item));
	if (ThingCmp(X, item) != EQ) printf("error in retr hash"); 
	Y = HashRm(H, key);
	assert(SameThing(Y, item));
	assert(SameThing(X, Y));
	DelThing(X);
	X = HashRm(H, key);
	assert(X == NULL);
	DelHash(H);
	//asm("int3");
	DelThing(Y); // this calls the dtor on item 
	DelThing(key);
	printf("Basic insert/retrieve in hash table done.\n");
}
开发者ID:EricSB,项目名称:tg-community,代码行数:28,代码来源:TestSuite.c

示例11: serv_puts

HashList *load_netconf(StrBuf *Target, WCTemplputParams *TP)
{
	StrBuf *Buf;
	HashList *Hash;
	char nnn[64];
	char buf[SIZ];
	int nUsed;
	NodeConf *Node;

	serv_puts("CONF getsys|application/x-citadel-ignet-config");
	serv_getln(buf, sizeof buf);
	if (buf[0] == '1') {
		Hash = NewHash(1, NULL);

		Buf = NewStrBuf();
		while (StrBuf_ServGetln(Buf), strcmp(ChrPtr(Buf), "000")) {
			Node = NewNode(Buf);
			if (Node != NULL) {
				nUsed = GetCount(Hash);
				nUsed = snprintf(nnn, sizeof(nnn), "%d", nUsed+1);
				Put(Hash, nnn, nUsed, Node, DeleteNodeConf); 
			}
		}
		FreeStrBuf(&Buf);
		return Hash;
	}
	return NULL;
}
开发者ID:mingodad,项目名称:citadel,代码行数:28,代码来源:netconf.c

示例12: assert

void OAEP_Base::Pad(RandomNumberGenerator &rng, const byte *input, size_t inputLength, byte *oaepBlock, size_t oaepBlockLen, const NameValuePairs &parameters) const
{
	assert (inputLength <= MaxUnpaddedLength(oaepBlockLen));

	// convert from bit length to byte length
	if (oaepBlockLen % 8 != 0)
	{
		oaepBlock[0] = 0;
		oaepBlock++;
	}
	oaepBlockLen /= 8;

	std::auto_ptr<HashTransformation> pHash(NewHash());
	const size_t hLen = pHash->DigestSize();
	const size_t seedLen = hLen, dbLen = oaepBlockLen-seedLen;
	byte *const maskedSeed = oaepBlock;
	byte *const maskedDB = oaepBlock+seedLen;

	ConstByteArrayParameter encodingParameters;
	parameters.GetValue(Name::EncodingParameters(), encodingParameters);

	// DB = pHash || 00 ... || 01 || M
	pHash->CalculateDigest(maskedDB, encodingParameters.begin(), encodingParameters.size());
	memset(maskedDB+hLen, 0, dbLen-hLen-inputLength-1);
	maskedDB[dbLen-inputLength-1] = 0x01;
	memcpy(maskedDB+dbLen-inputLength, input, inputLength);

	rng.GenerateBlock(maskedSeed, seedLen);
	std::auto_ptr<MaskGeneratingFunction> pMGF(NewMGF());
	pMGF->GenerateAndMask(*pHash, maskedDB, dbLen, maskedSeed, seedLen);
	pMGF->GenerateAndMask(*pHash, maskedSeed, seedLen, maskedDB, dbLen);
}
开发者ID:007pig,项目名称:BitcoinArmory,代码行数:32,代码来源:oaep.cpp

示例13: NewHash

Parm *NewParm(SwigType *type, String_or_char *n) {
  Parm *p = NewHash();
  
  if (type) {
    Setattr(p,"type", Copy(type));
  }
  Setattr(p,"name",n);
  return p;
}
开发者ID:kanbang,项目名称:Colt,代码行数:9,代码来源:parms.c

示例14: POP3C_GetListCommandState

eNextState POP3C_GetListCommandState(pop3aggr *RecvMsg)
{
	AsyncIO *IO = &RecvMsg->IO;
	POP3C_DBG_READ();
	if (!POP3C_OK) return eTerminateConnection;
	RecvMsg->MsgNumbers = NewHash(1, NULL);
	RecvMsg->State++;
	return eReadMore;
}
开发者ID:henri14,项目名称:citadel,代码行数:9,代码来源:serv_pop3client.c

示例15: malloc

Wrapper *NewWrapper(void) {
  Wrapper *w;
  w = (Wrapper *) malloc(sizeof(Wrapper));
  w->localh = NewHash();
  w->locals = NewStringEmpty();
  w->code = NewStringEmpty();
  w->def = NewStringEmpty();
  return w;
}
开发者ID:SumiTomohiko,项目名称:Yog,代码行数:9,代码来源:wrapfunc.c


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