fiat

package
v1.12.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 19, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Copyright 2021 The Go Authors. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. Code generated by addchain. DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SM2P256Element

type SM2P256Element struct {
	// contains filtered or unexported fields
}

SM2P256Element is an integer modulo 2^256 - 2^224 - 2^96 + 2^64 - 1.

The zero value is a valid zero element.

func (*SM2P256Element) Add

func (e *SM2P256Element) Add(t1, t2 *SM2P256Element) *SM2P256Element

Add sets e = t1 + t2, and returns e.

func (*SM2P256Element) Bytes

func (e *SM2P256Element) Bytes() []byte

Bytes returns the 32-byte big-endian encoding of e.

func (*SM2P256Element) Equal

func (e *SM2P256Element) Equal(t *SM2P256Element) int

Equal returns 1 if e == t, and zero otherwise.

func (*SM2P256Element) Invert

Invert sets e = 1/x, and returns e.

If x == 0, Invert returns e = 0.

func (*SM2P256Element) IsZero

func (e *SM2P256Element) IsZero() int

IsZero returns 1 if e == 0, and zero otherwise.

func (*SM2P256Element) Mul

func (e *SM2P256Element) Mul(t1, t2 *SM2P256Element) *SM2P256Element

Mul sets e = t1 * t2, and returns e.

func (*SM2P256Element) One

func (e *SM2P256Element) One() *SM2P256Element

One sets e = 1, and returns e.

func (*SM2P256Element) Select

func (v *SM2P256Element) Select(a, b *SM2P256Element, cond int) *SM2P256Element

Select sets v to a if cond == 1, and to b if cond == 0.

func (*SM2P256Element) Set

Set sets e = t, and returns e.

func (*SM2P256Element) SetBytes

func (e *SM2P256Element) SetBytes(v []byte) (*SM2P256Element, error)

SetBytes sets e = v, where v is a big-endian 32-byte encoding, and returns e. If v is not 32 bytes or it encodes a value higher than 2^256 - 2^224 - 2^96 + 2^64 - 1, SetBytes returns nil and an error, and e is unchanged.

func (*SM2P256Element) Square

Square sets e = t * t, and returns e.

func (*SM2P256Element) Sub

func (e *SM2P256Element) Sub(t1, t2 *SM2P256Element) *SM2P256Element

Sub sets e = t1 - t2, and returns e.

type SM2P256OrderElement

type SM2P256OrderElement struct {
	// contains filtered or unexported fields
}

SM2P256OrderElement is an integer modulo 0xFFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFF7203DF6B21C6052B53BBF40939D54123.

The zero value is a valid zero element.

func (*SM2P256OrderElement) Add

Add sets e = t1 + t2, and returns e.

func (*SM2P256OrderElement) Bytes

func (e *SM2P256OrderElement) Bytes() []byte

Bytes returns the 32-byte big-endian encoding of e.

func (*SM2P256OrderElement) Mul

Mul sets e = t1 * t2, and returns e.

func (*SM2P256OrderElement) One

One sets e = 1, and returns e.

func (*SM2P256OrderElement) Select

Select sets v to a if cond == 1, and to b if cond == 0.

func (*SM2P256OrderElement) SetBytes

func (e *SM2P256OrderElement) SetBytes(v []byte) (*SM2P256OrderElement, error)

SetBytes sets e = v, where v is a big-endian 32-byte encoding, and returns e. If v is not 32 bytes or it encodes a value higher than 2^256 - 2^224 - 2^96 + 2^64 - 1, SetBytes returns nil and an error, and e is unchanged.

func (*SM2P256OrderElement) Square

Square sets e = t * t, and returns e.

func (*SM2P256OrderElement) Sub

Sub sets e = t1 - t2, and returns e.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL