<commit_before>/*
 * RELIC is an Efficient LIbrary for Cryptography
 * Copyright (C) 2007, 2008, 2009 RELIC Authors
 *
 * This file is part of RELIC. RELIC is legal property of its developers,
 * whose names are not listed here. Please refer to the COPYRIGHT file
 * for contact information.
 *
 * RELIC is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * RELIC is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with RELIC. If not, see <http://www.gnu.org/licenses/>.
 */

/**
 * @defgroup pc Pairing-based cryptography.
 */

/**
 * @file
 *
 * Abstractions of pairing computation useful to protocol implementors.
 *
 * @version $Id$
 * @ingroup pc
 */

#ifndef RELIC_PC_H
#define RELIC_PC_H

#include "relic_ep.h"
#include "relic_eb.h"
#include "relic_pp.h"
#include "relic_pb.h"
#include "relic_bn.h"
#include "relic_util.h"
#include "relic_conf.h"
#include "relic_types.h"

/*============================================================================*/
/* Constant definitions                                                       */
/*============================================================================*/

/**
 * Prefix for mappings of functions.
 */
#if PC_CUR == PRIME
#define G1_LOWER			ep2_
#define G2_LOWER			ep_
#define GT_LOWER			fp12_
#define PC_LOWER			pp_
#elif PC_CUR == BINAR
#define G1_LOWER			eb_
#define G2_LOWER			eb_
#define GT_LOWER			fb4_
#define PC_LOWER			pb_
#endif

/**
 * Prefix for mappings of constant definitions.
 */
#if PC_CUR == PRIME
#define EC_UPPER			EP_
#define PC_UPPER			PP_
#elif EC_CUR == BINAR
#define EC_UPPER			EB_
#define PC_UPPER			PB_
#endif

/**
 * Size of a precomputation table using the chosen algorithm.
 */
#if EC_CUR == PRIME
#define EC_TABLE			EP_TABLE
#elif EC_CUR == BINAR
#define EC_TABLE			EB_TABLE
#endif

/*============================================================================*/
/* Type definitions                                                           */
/*============================================================================*/

/**
 * Represents a G_1 element.
 */
typedef CAT(G1_LOWER, t) g1_t;

/**
 * Represents a G_1 element.
 */
typedef CAT(G2_LOWER, t) g2_t;

/**
 * Represents a G_1 element.
 */
typedef CAT(GT_LOWER, t) gt_t;

/*============================================================================*/
/* Macro definitions                                                          */
/*============================================================================*/

/**
 * Initializes a G_1 element with a null value.
 *
 * @param[out] A			- the element to initialize.
 */
#define g1_null(A)			CAT(G1_LOWER, null)(A)

/**
 * Initializes a G_2 element with a null value.
 *
 * @param[out] A			- the element to initialize.
 */
#define g2_null(A)			CAT(G2_LOWER, null)(A)
<commit_msg>Initial implementation of pc_ abstraction layer.<commit_after>/*
 * RELIC is an Efficient LIbrary for Cryptography
 * Copyright (C) 2007, 2008, 2009 RELIC Authors
 *
 * This file is part of RELIC. RELIC is legal property of its developers,
 * whose names are not listed here. Please refer to the COPYRIGHT file
 * for contact information.
 *
 * RELIC is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * RELIC is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with RELIC. If not, see <http://www.gnu.org/licenses/>.
 */

/**
 * @defgroup pc Pairing-based cryptography.
 */

/**
 * @file
 *
 * Abstractions of pairing computation useful to protocol implementors.
 *
 * @version $Id$
 * @ingroup pc
 */

#ifndef RELIC_PC_H
#define RELIC_PC_H

#include "relic_ep.h"
#include "relic_eb.h"
#include "relic_pp.h"
#include "relic_pb.h"
#include "relic_bn.h"
#include "relic_util.h"
#include "relic_conf.h"
#include "relic_types.h"

/*============================================================================*/
/* Constant definitions                                                       */
/*============================================================================*/

/**
 * Prefix for mappings of functions.
 */
#if PC_CUR == PRIME
#define G1_LOWER			ep2_
#define G2_LOWER			ep_
#define GT_LOWER			fp12_
#define PC_LOWER			pp_
#elif PC_CUR == BINAR
#define G1_LOWER			eb_
#define G2_LOWER			eb_
#define GT_LOWER			fb4_
#define PC_LOWER			pb_
#endif

/**
 * Prefix for mappings of constant definitions.
 */
#if PC_CUR == PRIME
#define EC_UPPER			EP_
#define PC_UPPER			PP_
#elif EC_CUR == BINAR
#define EC_UPPER			EB_
#define PC_UPPER			PB_
#endif

/**
 * Size of a precomputation table using the chosen algorithm.
 */
#if EC_CUR == PRIME
#define EC_TABLE			EP_TABLE
#elif EC_CUR == BINAR
#define EC_TABLE			EB_TABLE
#endif

/*============================================================================*/
/* Type definitions                                                           */
/*============================================================================*/

/**
 * Represents a G_1 element.
 */
typedef CAT(G1_LOWER, t) g1_t;

/**
 * Represents a G_1 element with automatic allocation.
 */
typedef CAT(G1_LOWER, st) g1_st;

/**
 * Represents a G_1 element.
 */
typedef CAT(G2_LOWER, t) g2_t;

/**
 * Represents a G_2 element with automatic allocation.
 */
typedef CAT(G2_LOWER, st) g2_st;

/**
 * Represents a G_1 element.
 */
typedef CAT(GT_LOWER, t) gt_t;

/*============================================================================*/
/* Macro definitions                                                          */
/*============================================================================*/

/**
 * Initializes a G_1 element with a null value.
 *
 * @param[out] A			- the element to initialize.
 */
#define g1_null(A)			CAT(G1_LOWER, null)(A)

/**
 * Initializes a G_2 element with a null value.
 *
 * @param[out] A			- the element to initialize.
 */
#define g2_null(A)			CAT(G2_LOWER, null)(A)

{'fraction_non_alphanumeric': 0.2235224411198341, 'fraction_numerical': 0.011257591467930678, 'mean_word_length': 3.336544637122672, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5729445', 'n_tokens_mistral': 2129, 'n_tokens_neox': 1970, 'n_words': 683}