github.com/shogo82148/std@v1.22.1-0.20240327122250-4e474527810c/crypto/internal/nistec/fiat/p521.go (about) 1 // Copyright 2021 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 // Code generated by generate.go. DO NOT EDIT. 6 7 package fiat 8 9 // P521Element is an integer modulo 2^521 - 1. 10 // 11 // The zero value is a valid zero element. 12 type P521Element struct { 13 // Values are represented internally always in the Montgomery domain, and 14 // converted in Bytes and SetBytes. 15 x p521MontgomeryDomainFieldElement 16 } 17 18 // One sets e = 1, and returns e. 19 func (e *P521Element) One() *P521Element 20 21 // Equal returns 1 if e == t, and zero otherwise. 22 func (e *P521Element) Equal(t *P521Element) int 23 24 // IsZero returns 1 if e == 0, and zero otherwise. 25 func (e *P521Element) IsZero() int 26 27 // Set sets e = t, and returns e. 28 func (e *P521Element) Set(t *P521Element) *P521Element 29 30 // Bytes returns the 66-byte big-endian encoding of e. 31 func (e *P521Element) Bytes() []byte 32 33 // SetBytes sets e = v, where v is a big-endian 66-byte encoding, and returns e. 34 // If v is not 66 bytes or it encodes a value higher than 2^521 - 1, 35 // SetBytes returns nil and an error, and e is unchanged. 36 func (e *P521Element) SetBytes(v []byte) (*P521Element, error) 37 38 // Add sets e = t1 + t2, and returns e. 39 func (e *P521Element) Add(t1, t2 *P521Element) *P521Element 40 41 // Sub sets e = t1 - t2, and returns e. 42 func (e *P521Element) Sub(t1, t2 *P521Element) *P521Element 43 44 // Mul sets e = t1 * t2, and returns e. 45 func (e *P521Element) Mul(t1, t2 *P521Element) *P521Element 46 47 // Square sets e = t * t, and returns e. 48 func (e *P521Element) Square(t *P521Element) *P521Element 49 50 // Select sets v to a if cond == 1, and to b if cond == 0. 51 func (v *P521Element) Select(a, b *P521Element, cond int) *P521Element