⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 xbn_fp2.h

📁 IBE是一种非对称密码技术
💻 H
字号:
/* Copyright 2003-2006, Voltage Security, all rights reserved.
 */

#include "ictk.h"
#include "xbn_z.h"
#include "xbn_fp.h"

#ifndef XBN_FP2_H
#define XBN_FP2_H

#ifdef __cplusplus
extern "C" {
#endif

/* allocates and inits new fp2
 */
int fp2New (
   bf_context_t *bf,
   fp2_t **newFp2
   );

/* clears and deallocates fp2
 */
void fp2Del (
   fp2_t *x
   );

/* Is a == 0
 */
bool_t fp2IsZero (
   fp2_t *a
   );

/* Does a == b
 */
bool_t fp2IsEqual (
   fp2_t *a,
   fp2_t *b
   );

/* Set x = a
 */
int fp2Set (
   fp2_t *x,
   fp2_t *a
   );

/* Set x = 0
 */
int fp2Set0 (
   fp2_t *x
   );

/* Set x = 1
 */
int fp2Set1 (
   fp2_t *x
   );

/* Set x = cube_root (1)
 */
int fp2SetCubeRootOne (
   fp2_t *x,
   z_t *p
   );

/* Set x = -a
 */
int fp2Negate (
   fp2_t *x,
   fp2_t *a,
   z_t *p
   );

/* x = a + b
 */
int fp2Add (
   fp2_t *x,
   fp2_t *a,
   fp2_t *b,
   z_t *p
   );

/* x = a - b
 */
int fp2Sub (
   fp2_t *x,
   fp2_t *a,
   fp2_t *b,
   z_t *p
   );

/* x = a * b
 */
int fp2Mul (
   fp2_t *x,
   fp2_t *a,
   fp2_t *b,
   z_t *p
   );

/* x = a * z
 */
int fp2MulZ (
   fp2_t *x,
   fp2_t *a,
   z_t *z,
   z_t *p
   );

/* x = a ^ 2
 */
int fp2Sqr (
   fp2_t *x,
   fp2_t *a,
   z_t *p
   );

/* x = a ^ 2; uses scratch vars u and v
 */
int fp2SqrGivenScratch (
   fp2_t *x,
   fp2_t *a,
   z_t *p,
   z_t *u,
   z_t *v
   );

/* x = a / b
 */
int fp2Div (
   fp2_t *x,
   fp2_t *a,
   fp2_t *b,
   z_t *p
   );

/* x = a ^ n
 */
int fp2Pow (
   fp2_t *x,
   fp2_t *a,
   z_t *n,
   z_t *p
   );

/* Set r = random element of F_p^2
 */
int fp2Random (
    fp2_t *r,
    z_t *p,
    VtRandomObject random
    );

#ifdef __cplusplus
}
#endif

#endif // XBN_FP2_H

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -