• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ NewHash函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: Swig_fragment_register

void
Swig_fragment_register(String *name, String *section, String *code) {
  String *ccode;
  if (!fragments) {
    fragments = NewHash();
  }
  ccode = Copy(code);
  Setmeta(ccode,"section",Copy(section));
  Setattr(fragments,Copy(name),ccode);
}
开发者ID:jumpinjackie,项目名称:node-mapguide,代码行数:10,代码来源:fragment.c


示例17: swill_user

void
swill_user(const char *name, const char *password) {
   String *str;
   if (!SwillInit) return;
   if (!SwillUsers) {
      SwillUsers = NewHash();
   }
   str = NewString("");
   Printf(str,"%s:%s",name,password);
   Setattr(SwillUsers,str,name);
}
开发者ID:zonbrisad,项目名称:makeplates,代码行数:11,代码来源:security.c


示例18: NewHash

Node *copyNode(Node *n) {
  Iterator ki;
  Node *c = NewHash();
  for (ki = First(n); ki.key; ki = Next(ki)) {
    if (DohIsString(ki.item)) {
      Setattr(c, ki.key, Copy(ki.item));
    }
  }
  Setfile(c, Getfile(n));
  Setline(c, Getline(n));
  return c;
}
开发者ID:GSGroup,项目名称:swig-v8,代码行数:12,代码来源:tree.c


示例19: Swig_warn

void Swig_warn(const char *filename, int line, const char *msg) {
  String *key;
  if (!warnings) {
    warnings = NewHash();
  }
  key = NewStringf("%s:%d", filename, line);
  if (!Getattr(warnings, key)) {
    Printf(stderr, "swig-dev warning:%s:%d:%s\n", filename, line, msg);
    Setattr(warnings, key, key);
  }
  Delete(key);
}
开发者ID:abhishekgahlot,项目名称:Python-Fingerprint-Attendance-System,代码行数:12,代码来源:warn.c


示例20: NewMailQEntry

void NewMailQEntry(OneQueItem *Item)
{
	Item->Current = (MailQEntry*) malloc(sizeof(MailQEntry));
	memset(Item->Current, 0, sizeof(MailQEntry));

	if (Item->MailQEntries == NULL)
		Item->MailQEntries = NewHash(1, Flathash);
	/* alocate big buffer so we won't get problems reallocating later. */
	Item->Current->StatusMessage = NewStrBufPlain(NULL, SIZ);
	Item->Current->n = GetCount(Item->MailQEntries);
	Put(Item->MailQEntries,
	    IKEY(Item->Current->n),
	    Item->Current,
	    FreeMailQEntry);
}
开发者ID:mingodad,项目名称:citadel,代码行数:15,代码来源:serv_smtpqueue.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ NewItemOrBag函数代码示例发布时间:2022-05-30
下一篇:
C++ NewHandle函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap