Changeset View
Changeset View
Standalone View
Standalone View
src/secp256k1/src/group_impl.h
/********************************************************************** | /********************************************************************** | ||||
* Copyright (c) 2013, 2014 Pieter Wuille * | * Copyright (c) 2013, 2014 Pieter Wuille * | ||||
* Distributed under the MIT software license, see the accompanying * | * Distributed under the MIT software license, see the accompanying * | ||||
* file COPYING or http://www.opensource.org/licenses/mit-license.php.* | * file COPYING or http://www.opensource.org/licenses/mit-license.php.* | ||||
**********************************************************************/ | **********************************************************************/ | ||||
#ifndef _SECP256K1_GROUP_IMPL_H_ | #ifndef SECP256K1_GROUP_IMPL_H | ||||
#define _SECP256K1_GROUP_IMPL_H_ | #define SECP256K1_GROUP_IMPL_H | ||||
#include "num.h" | #include "num.h" | ||||
#include "field.h" | #include "field.h" | ||||
#include "group.h" | #include "group.h" | ||||
/* These points can be generated in sage as follows: | /* These points can be generated in sage as follows: | ||||
* | * | ||||
* 0. Setup a worksheet with the following parameters. | * 0. Setup a worksheet with the following parameters. | ||||
▲ Show 20 Lines • Show All 675 Lines • ▼ Show 20 Lines | static int secp256k1_gej_has_quad_y_var(const secp256k1_gej *a) { | ||||
/* We rely on the fact that the Jacobi symbol of 1 / a->z^3 is the same as | /* We rely on the fact that the Jacobi symbol of 1 / a->z^3 is the same as | ||||
* that of a->z. Thus a->y / a->z^3 is a quadratic residue iff a->y * a->z | * that of a->z. Thus a->y / a->z^3 is a quadratic residue iff a->y * a->z | ||||
is */ | is */ | ||||
secp256k1_fe_mul(&yz, &a->y, &a->z); | secp256k1_fe_mul(&yz, &a->y, &a->z); | ||||
return secp256k1_fe_is_quad_var(&yz); | return secp256k1_fe_is_quad_var(&yz); | ||||
} | } | ||||
#endif | #endif /* SECP256K1_GROUP_IMPL_H */ |