Documentation
¶
Overview ¶
Copyright Consensys Software Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-License-Identifier: Apache-2.0
Index ¶
- Constants
- type Element
- func (x Element) Add(y Element) Element
- func (x Element) AddBytes(b []byte) Element
- func (x Element) AddUint32(y uint32) Element
- func (x Element) Bytes() []byte
- func (x Element) Cmp(y Element) int
- func (x Element) Double() Element
- func (x Element) Equals(o Element) bool
- func (x Element) Half() Element
- func (x Element) Hash() uint64
- func (x Element) Inverse() Element
- func (x Element) IsOne() bool
- func (x Element) IsZero() bool
- func (x Element) Modulus() *big.Int
- func (x Element) Mul(y Element) Element
- func (x Element) SetBytes(bs []byte) Element
- func (x Element) SetUint64(val uint64) Element
- func (x Element) String() string
- func (x Element) Sub(y Element) Element
- func (x Element) Text(base int) string
- func (x Element) ToUint32() uint32
- func (x Element) Uint64() uint64
Constants ¶
const (
Modulus = 251
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Element ¶
type Element [1]uint32 // defined as an array to prevent mistaken use of arithmetic operators, or naive assignments.
Element of a prime order field, represented in Montgomery form to speed up multiplications.
func New ¶ added in v1.1.15
New returns an element of the field f corresponding to the natural number x.
func (Element) AddBytes ¶
AddBytes adds the Element to the given big-endian value. It expects exactly 2 input bytes.
func (Element) Bytes ¶
Bytes returns the big-endian encoded value of the Element, possibly with leading zeros.