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

C++ check_key函数代码示例

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

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



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

示例1: handle_key_1

void handle_key_1(s32 val) {
  if(val == 0) { return; }
    if(altMode) {
      if(check_key(1)) {
	// show / hide on play screen
	net_toggle_in_play(*pageSelect);
	// render to tmp buffer
	render_line(*pageSelect, 0xf);
	// copy to scroll with highlight
	render_to_scroll_line(SCROLL_CENTER_LINE, 1);
      }
    } else {
      if(check_key(1)) {
	// show preset name in head region
	draw_preset_name();
	// include / exclude in preset
	net_toggle_in_preset(*pageSelect);
	// render to tmp buffer
	render_line(*pageSelect, 0xf);
	// copy to scroll with highlight
	render_to_scroll_line(SCROLL_CENTER_LINE, 1);
      }
    }
    show_foot();
}
开发者ID:bbnickell,项目名称:aleph,代码行数:25,代码来源:page_ins.c


示例2: check_data

int check_data(timing_data* data, key_data * key){
    unsigned char key_guess[KEY_LENGTH];
    int i;

    compute_cost(data, key);
    compute_rank_table(data, key);

    first_guess(data, key_guess);
    printf("\nInitial guess: ");
    for(i = 0; i < KEY_LENGTH; i++)
      printf(" %02x ", key_guess[i]);

    walk(data, key_guess);
    printf("Walk         : "); 

    if(check_key(key_guess, data, key) )
       return 1;

    for(i = 0; i < KEY_LENGTH; i++)
      printf(" %02x ", key_guess[i]);

    if(check_key(key_guess, data, key) )
       return 1;

    return 0;
}
开发者ID:jamella,项目名称:aes_cache,代码行数:26,代码来源:nxhs_alg.c


示例3: parseAccountAddressString

  //-----------------------------------------------------------------------
  bool parseAccountAddressString(uint64_t& prefix, AccountPublicAddress& adr, const std::string& str) {
    std::string data;

    return
      Tools::Base58::decode_addr(str, prefix, data) &&
      fromBinaryArray(adr, asBinaryArray(data)) &&
      // ::serialization::parse_binary(data, adr) &&
      check_key(adr.spendPublicKey) &&
      check_key(adr.viewPublicKey);
  }
开发者ID:iamsmooth,项目名称:bitcedi,代码行数:11,代码来源:CryptoNoteBasicImpl.cpp


示例4: use_item_2

void	use_item_2(t_data *data, t_items *tmp)
{
  if (tmp->item_id == 0)
    launch_turtle(data);
  if (tmp->item_id == 2)
    check_key(data, 2);
  if (tmp->item_id == 4)
    check_key(data, 4);
  if (tmp->item_id == 3)
    carli_gift(data);
  if (tmp->item_id == 1)
    chat_gift(data);
}
开发者ID:GastaldiRemi,项目名称:Tek_adventure,代码行数:13,代码来源:inventory.c


示例5: configure_assembly

/*---------------------------------------------------------------------------*\
| \fn       configure_assembly
| \brief    Configures the assembly state from the order
\*---------------------------------------------------------------------------*/
void configure_assembly(
    TOrderMap&  order )
{
    AssemblyState state;
    state.set_defaults();

    /*-----------------------------------------------------------------------*\
    |   Check if specific items are present in order, and notify of defaults
    \*-----------------------------------------------------------------------*/
    bool present = check_key( order, 
        "plastic", 
        "\t<>Unknown plastic || defaulting to ABS." );

    if ( present )
    {
        state.set_plastic_type( order["plastic"] );
    }

    present = check_key( order, 
        "size", 
        "\t<>No size specified, defaulting to 100." );

    if ( present )
    {
        state.set_order_size( std::stoi( order["size"] ) );
    }

    present = check_key( order, 
        "packager", 
        "\t<>Unknown packager || defaulting to Bulk packager." );

    if ( present )
    {
        state.set_packager( order["packager"] );
    }

    present = check_key( order, 
        "stuffer", 
        "\t<>Unknown stuffer || defaulting to Air stuffer." );

    if ( present )
    {
        state.set_stuffer( order["stuffer"] );
    }

    PlasticType plastic = state.get_plastic_enum();
    TAssemblyLinePtr injection_line( 
        AssemblyLineFactory::get_assembly_line( order, plastic ) );

    injection_line->process_order();
}
开发者ID:gnawme,项目名称:design-patterns,代码行数:55,代码来源:OrderProcessing.cpp


示例6: check_key

/*---------------------------------------------------------------------------*\
| \fn       AssemblyLineTemplate::load_additive_bins
| \brief    Step 4
| \note     Has virtual hook
\*---------------------------------------------------------------------------*/
void AssemblyLineTemplate::load_additive_bins()
{
    std::cout 
    << "\t\tLoad plastic, color, and additive bins." 
    << std::endl;

    /*-----------------------------------------------------------------------*\
    |   Get color specified
    \*-----------------------------------------------------------------------*/
    AssemblyState state;
    bool has_color = check_key( m_order, "color" );
    if ( has_color )
    {
        state.set_color( m_order[ "color" ] );
    }
    else
    {
        std::cout
        << "\t\t\t<>No color specified, defaulting to black."
        << std::endl;
    }

    /*-----------------------------------------------------------------------*\
    |   Get additives
    \*-----------------------------------------------------------------------*/
    for ( auto additive : c_valid_additives )
    {
        bool has_additive = check_key( m_order, additive );
        if ( has_additive )
        {
            int volume = std::stoi( m_order[additive] );
            state.set_additive( additive, volume );
        }  
    }

    load_additive_hook();

    /*-----------------------------------------------------------------------*\
    |   Output aggregated description and volume
    \*-----------------------------------------------------------------------*/
    int volume = m_injector->num_cavities() * m_recipe->volume();
    std::cout
    << "\t\t\tRecipe: "
    << m_recipe->description()
    << " Total = "
    << volume
    << "."
    << std::endl;

}
开发者ID:gnawme,项目名称:design-patterns,代码行数:55,代码来源:AssemblyLineTemplate.cpp


示例7: generate_key_random

/*
 * Generate a random key.  If key_type is provided, make
 * sure generated key is valid for key_type.
 */
void
generate_key_random (struct key *key, const struct key_type *kt)
{
  int cipher_len = MAX_CIPHER_KEY_LENGTH;
  int hmac_len = MAX_HMAC_KEY_LENGTH;

  struct gc_arena gc = gc_new ();

  do {
    CLEAR (*key);
    if (kt)
      {
	if (kt->cipher && kt->cipher_length > 0 && kt->cipher_length <= cipher_len)
	  cipher_len = kt->cipher_length;

	if (kt->digest && kt->hmac_length > 0 && kt->hmac_length <= hmac_len)
	  hmac_len = kt->hmac_length;
      }
    if (!rand_bytes (key->cipher, cipher_len)
	|| !rand_bytes (key->hmac, hmac_len))
      msg (M_FATAL, "ERROR: Random number generator cannot obtain entropy for key generation");

    dmsg (D_SHOW_KEY_SOURCE, "Cipher source entropy: %s", format_hex (key->cipher, cipher_len, 0, &gc));
    dmsg (D_SHOW_KEY_SOURCE, "HMAC source entropy: %s", format_hex (key->hmac, hmac_len, 0, &gc));

    if (kt)
      fixup_key (key, kt);
  } while (kt && !check_key (key, kt));

  gc_free (&gc);
}
开发者ID:KatekovAnton,项目名称:iOS-OpenVPN-Sample,代码行数:35,代码来源:crypto.c


示例8: main

// typical usage of Elektra
int main()
{
	Key * error_key = keyNew(KEY_END);
	KDB * kdb_handle = kdbOpen(error_key);
	Key * top = keyNew(KEY_END);
	keySetName(top, "user/sw/MyApp");

	KeySet * ks = ksNew(0);
	kdbGet(kdb_handle, ks, top);

	Key * key = keyNew(KEY_END);
	keySetName(key, "user/sw/MyApp/Tests/TestKey1"); // == 31
	keySetString(key, "NULLTestValue"); // == 14
	keySetMeta(key, "comment", "NULLTestComment"); // == 16
	ksAppendKey(ks, key); // == 1
	keyNeedSync(key);
	kdbSet(kdb_handle, ks, top); // == -1
	print_warnings(top);
	keyDel(top);
	ksDel(ks);
	kdbClose(kdb_handle, error_key);
	keyDel(error_key);

	check_key();

	return 0;
}
开发者ID:intfrr,项目名称:libelektra,代码行数:28,代码来源:set.c


示例9: _cpri__ValidateSignatureRSA

CRYPT_RESULT _cpri__ValidateSignatureRSA(
	RSA_KEY *key, TPM_ALG_ID padding_alg, TPM_ALG_ID hash_alg,
	uint32_t digest_len, uint8_t *digest, uint32_t sig_len,
	uint8_t *sig, uint16_t salt_len)
{
	struct RSA rsa;
	enum padding_mode padding;
	enum hashing_mode hashing;

	if (!check_key(key))
		return CRYPT_FAIL;
	if (!check_sign_params(padding_alg, hash_alg, &padding, &hashing))
		return CRYPT_FAIL;

	rsa.e = key->exponent;
	rsa.N.dmax = key->publicKey->size / sizeof(uint32_t);
	rsa.N.d = (struct access_helper *) &key->publicKey->buffer;
	rsa.d.dmax = 0;
	rsa.d.d = NULL;

	if (DCRYPTO_rsa_verify(&rsa, digest, digest_len, sig, sig_len,
				padding, hashing))
		return CRYPT_SUCCESS;
	else
		return CRYPT_FAIL;
}
开发者ID:littlebabay,项目名称:chrome-ec,代码行数:26,代码来源:rsa.c


示例10: handle_key_2

// copy / clear / confirm
void handle_key_2(s32 val) {
  if(val == 1) { return; }
  if(check_key(2)) {
    preset_clear(*pageSelect);
  }
  show_foot();
}
开发者ID:catfact,项目名称:aleph,代码行数:8,代码来源:page_presets.c


示例11: sr_config_list

/**
 * List all possible values for a configuration key.
 *
 * @param[in] driver The sr_dev_driver struct to query. Must not be NULL.
 * @param[in] sdi (optional) If the key is specific to a device, this must
 *            contain a pointer to the struct sr_dev_inst to be checked.
 *            Otherwise it must be NULL. If sdi is != NULL, sdi->priv must
 *            also be != NULL.
 * @param[in] cg The channel group on the device for which to list the
 *                    values, or NULL.
 * @param[in] key The configuration key (SR_CONF_*).
 * @param[in,out] data A pointer to a GVariant where the list will be stored.
 *             The caller is given ownership of the GVariant and must thus
 *             unref the GVariant after use. However if this function
 *             returns an error code, the field should be considered
 *             unused, and should not be unreferenced.
 *
 * @retval SR_OK Success.
 * @retval SR_ERR Error.
 * @retval SR_ERR_ARG The driver doesn't know that key, but this is not to be
 *          interpreted as an error by the caller; merely as an indication
 *          that it's not applicable.
 *
 * @since 0.3.0
 */
SR_API int sr_config_list(const struct sr_dev_driver *driver,
		const struct sr_dev_inst *sdi,
		const struct sr_channel_group *cg,
		uint32_t key, GVariant **data)
{
	int ret;

	if (!driver || !data)
		return SR_ERR;
	else if (!driver->config_list)
		return SR_ERR_ARG;
	else if (key != SR_CONF_SCAN_OPTIONS && key != SR_CONF_DEVICE_OPTIONS) {
		if (check_key(driver, sdi, cg, key, SR_CONF_LIST, NULL) != SR_OK)
			return SR_ERR_ARG;
	}
	if (sdi && !sdi->priv) {
		sr_err("Can't list config (sdi != NULL, sdi->priv == NULL).");
		return SR_ERR;
	}
	if ((ret = driver->config_list(key, data, sdi, cg)) == SR_OK) {
		log_key(sdi, cg, key, SR_CONF_LIST, *data);
		g_variant_ref_sink(*data);
	}

	return ret;
}
开发者ID:StefanBruens,项目名称:libsigrok,代码行数:51,代码来源:hwdriver.c


示例12: sr_config_get

/**
 * Query value of a configuration key at the given driver or device instance.
 *
 * @param[in] driver The sr_dev_driver struct to query. Must not be NULL.
 * @param[in] sdi (optional) If the key is specific to a device, this must
 *            contain a pointer to the struct sr_dev_inst to be checked.
 *            Otherwise it must be NULL. If sdi is != NULL, sdi->priv must
 *            also be != NULL.
 * @param[in] cg The channel group on the device for which to list the
 *                    values, or NULL.
 * @param[in] key The configuration key (SR_CONF_*).
 * @param[in,out] data Pointer to a GVariant where the value will be stored.
 *             Must not be NULL. The caller is given ownership of the GVariant
 *             and must thus decrease the refcount after use. However if
 *             this function returns an error code, the field should be
 *             considered unused, and should not be unreferenced.
 *
 * @retval SR_OK Success.
 * @retval SR_ERR Error.
 * @retval SR_ERR_ARG The driver doesn't know that key, but this is not to be
 *          interpreted as an error by the caller; merely as an indication
 *          that it's not applicable.
 *
 * @since 0.3.0
 */
SR_API int sr_config_get(const struct sr_dev_driver *driver,
		const struct sr_dev_inst *sdi,
		const struct sr_channel_group *cg,
		uint32_t key, GVariant **data)
{
	int ret;

	if (!driver || !data)
		return SR_ERR;

	if (!driver->config_get)
		return SR_ERR_ARG;

	if (check_key(driver, sdi, cg, key, SR_CONF_GET, NULL) != SR_OK)
		return SR_ERR_ARG;

	if (sdi && !sdi->priv) {
		sr_err("Can't get config (sdi != NULL, sdi->priv == NULL).");
		return SR_ERR;
	}

	if ((ret = driver->config_get(key, data, sdi, cg)) == SR_OK) {
		log_key(sdi, cg, key, SR_CONF_GET, *data);
		/* Got a floating reference from the driver. Sink it here,
		 * caller will need to unref when done with it. */
		g_variant_ref_sink(*data);
	}

	return ret;
}
开发者ID:StefanBruens,项目名称:libsigrok,代码行数:55,代码来源:hwdriver.c


示例13: handle_key_0

// store
void handle_key_0(s32 val) {
  if(val == 0) { return; }
  if(check_key(0)) {
    region_fill(headRegion, 0x0);
    font_string_region_clip(headRegion, "writing scene to card...", 0, 0, 0xa, 0);
    headRegion->dirty = 1;
    render_update();
    region_fill(headRegion, 0x0);


    //    files_store_scene_name(sceneData->desc.sceneName, 1);
    files_store_scene_name(sceneData->desc.sceneName);

    print_dbg("\r\n stored scene, back to handler");
    
    font_string_region_clip(headRegion, "done writing.", 0, 0, 0xa, 0);
    headRegion->dirty = 1;
    render_update();

    // refresh
    //    redraw_lines();
    redraw_scenes();
  }
  show_foot();
}
开发者ID:bbnickell,项目名称:aleph,代码行数:26,代码来源:page_scenes.c


示例14: handle_key_1

// recall
void handle_key_1(s32 val) {
  if(val == 1) { return; }
  if(check_key(1)) {
    preset_recall(*pageSelect);
  }
  show_foot();
}
开发者ID:bensteinberg,项目名称:aleph,代码行数:8,代码来源:page_presets.c


示例15: handle_key_2

void handle_key_2(s32 val) {
    if(val == 0) {
        return;
    }
    if(check_key(2)) {
        if(altMode) {
            // filter / all
        } else {
            if(zeroed) {
                /// set to max
                net_set_in_value(*pageSelect, OP_MAX_VAL);
                zeroed = 0;
            } else {
                /// set to 0
                net_set_in_value(*pageSelect, 0);
                zeroed = 1;
            }
            // render to tmp buffer
            render_line(*pageSelect, 0xf);
            // copy to scroll with highlight
            render_to_scroll_line(SCROLL_CENTER_LINE, 1);
        }
    }
    show_foot();
}
开发者ID:patgarner,项目名称:aleph,代码行数:25,代码来源:page_ins.c


示例16: _cpri__DecryptRSA

CRYPT_RESULT _cpri__DecryptRSA(uint32_t *out_len, uint8_t *out,
			RSA_KEY *key, TPM_ALG_ID padding_alg,
			uint32_t in_len, uint8_t *in,
			TPM_ALG_ID hash_alg, const char *label)
{
	struct RSA rsa;
	enum padding_mode padding;
	enum hashing_mode hashing;

	if (!check_key(key))
		return CRYPT_FAIL;
	if (!check_encrypt_params(padding_alg, hash_alg, &padding, &hashing))
		return CRYPT_FAIL;

	rsa.e = key->exponent;
	rsa.N.dmax = key->publicKey->size / sizeof(uint32_t);
	rsa.N.d = (struct access_helper *) &key->publicKey->buffer;
	rsa.d.dmax = key->privateKey->size / sizeof(uint32_t);
	rsa.d.d = (struct access_helper *) &key->privateKey->buffer;

	if (DCRYPTO_rsa_decrypt(&rsa, out, out_len, in, in_len, padding,
					hashing, label))
		return CRYPT_SUCCESS;
	else
		return CRYPT_FAIL;
}
开发者ID:littlebabay,项目名称:chrome-ec,代码行数:26,代码来源:rsa.c


示例17: handle_key_0

// store
void handle_key_0(s32 val) {
  if(val == 0) { return; }
  if(check_key(0)) {
    preset_store(*pageSelect);
  }
  show_foot();
}
开发者ID:bensteinberg,项目名称:aleph,代码行数:8,代码来源:page_presets.c


示例18: handle_key_0

// function keys
void handle_key_0(s32 val) {
  // load module
  if(val == 0) { return; }
  if(check_key(0)) {
    notify("loading...");
    // don't do this! let it break?
    //    net_clear_user_ops();
    // disconnect parameters though
    net_disconnect_params();

    files_load_dsp(*pageSelect);

    bfin_wait_ready();

    scene_query_module();

    net_report_params();

    bfin_enable();

    redraw_ins();
    redraw_dsp();

    notify("finished loading.");
  }
  show_foot();
}
开发者ID:bensteinberg,项目名称:aleph,代码行数:28,代码来源:page_dsp.c


示例19: process_arguments

static void process_arguments(int argc, char **argv)
{
	char co;
	while ((co = getopt(argc, argv, "hf:g:uc:s")) != EOF) {
		switch(co) {
		case 'h':
			help();
			exit(0);
		case 's':
			check_key();
			break;
		case 'g':
			create_new_key_and_activate(optarg);
			break;
		case 'u':
			delete_key();
			break;
		case 'c':
			create_file_from_key(optarg);
			break;
		case 'f':
			load_key_from_file_and_activate(optarg);
			break;
		default:
			help();
			break;
		}
	}
}
开发者ID:AIdrifter,项目名称:samba,代码行数:29,代码来源:smbta-util.c


示例20: handle_key_1

void handle_key_1(s32 val) {
    s16 newOut;
    if(val == 0) {
        return;
    }
    if(check_key(1)) {
        if(altMode) {
            print_dbg("\r\n splitting output: ");
            print_dbg_ulong(*pageSelect);
            newOut = net_split_out(*pageSelect);
            *pageSelect = newOut;
            redraw_outs();
        } else {
            // include / exclude in selected preset
            // show preset name in head region
            draw_preset_name();
            // include / exclude in preset
            net_toggle_out_preset(*pageSelect);
            // re-draw selected line to update inclusion glyph
            // render to tmp buffer
            render_line(*pageSelect, 0xf);
            // copy to scroll with highlight
            render_to_scroll_line(SCROLL_CENTER_LINE, 1);
        }
    }
    show_foot();
}
开发者ID:samdoshi,项目名称:aleph,代码行数:27,代码来源:page_outs.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ check_list函数代码示例发布时间:2022-05-30
下一篇:
C++ check_jvmti_error函数代码示例发布时间: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