fiat

package
v1.0.4020 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

README

The code in this package was autogenerated by the fiat-crypto project
at version v0.0.9 from a formally verified model, and by the addchain
project at a recent tip version.

    docker build -t fiat-crypto:v0.0.9 .
    go install github.com/mmcloughlin/addchain/cmd/addchain@v0.4.0
    go run generate.go

fiat-crypto code comes under the following license.

    Copyright (c) 2015-2020 The fiat-crypto Authors. All rights reserved.

    Redistribution and use in source and binary forms, with or without
    modification, are permitted provided that the following conditions are
    met:

        1. Redistributions of source code must retain the above copyright
        notice, this list of conditions and the following disclaimer.

    THIS SOFTWARE IS PROVIDED BY the fiat-crypto authors "AS IS"
    AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
    THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
    PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Berkeley Software Design,
    Inc. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
    EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
    PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
    PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
    LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
    NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
    SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

The authors are listed at

    https://github.com/mit-plv/fiat-crypto/blob/master/AUTHORS

Documentation

Overview

Code generated by generate.go. DO NOT EDIT.

Code generated by generate.go. DO NOT EDIT.

Code generated by generate.go. DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type P256Element

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

P256Element is an integer modulo 2^256 - 189.

The zero value is a valid zero element.

func (*P256Element) Add

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

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

func (*P256Element) Bytes

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

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

func (*P256Element) Equal

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

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

func (*P256Element) Invert

func (e *P256Element) Invert(x *P256Element) *P256Element

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

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

func (*P256Element) IsZero

func (e *P256Element) IsZero() int

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

func (*P256Element) Mul

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

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

func (*P256Element) One

func (e *P256Element) One() *P256Element

One sets e = 1, and returns e.

func (*P256Element) Select

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

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

func (*P256Element) Set

func (e *P256Element) Set(t *P256Element) *P256Element

Set sets e = t, and returns e.

func (*P256Element) SetBytes

func (e *P256Element) SetBytes(v []byte) (*P256Element, 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 - 189, SetBytes returns nil and an error, and e is unchanged.

func (*P256Element) Square

func (e *P256Element) Square(t *P256Element) *P256Element

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

func (*P256Element) Sub

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

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

type P384Element

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

P384Element is an integer modulo 2^384 - 317.

The zero value is a valid zero element.

func (*P384Element) Add

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

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

func (*P384Element) Bytes

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

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

func (*P384Element) Equal

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

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

func (*P384Element) Invert

func (e *P384Element) Invert(x *P384Element) *P384Element

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

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

func (*P384Element) IsZero

func (e *P384Element) IsZero() int

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

func (*P384Element) Mul

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

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

func (*P384Element) One

func (e *P384Element) One() *P384Element

One sets e = 1, and returns e.

func (*P384Element) Select

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

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

func (*P384Element) Set

func (e *P384Element) Set(t *P384Element) *P384Element

Set sets e = t, and returns e.

func (*P384Element) SetBytes

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

SetBytes sets e = v, where v is a big-endian 48-byte encoding, and returns e. If v is not 48 bytes or it encodes a value higher than 2^384 - 317, SetBytes returns nil and an error, and e is unchanged.

func (*P384Element) Square

func (e *P384Element) Square(t *P384Element) *P384Element

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

func (*P384Element) Sub

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

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

type P512Element

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

P512Element is an integer modulo 2^512 - 569.

The zero value is a valid zero element.

func (*P512Element) Add

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

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

func (*P512Element) Bytes

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

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

func (*P512Element) Equal

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

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

func (*P512Element) Invert

func (e *P512Element) Invert(x *P512Element) *P512Element

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

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

func (*P512Element) IsZero

func (e *P512Element) IsZero() int

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

func (*P512Element) Mul

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

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

func (*P512Element) One

func (e *P512Element) One() *P512Element

One sets e = 1, and returns e.

func (*P512Element) Select

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

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

func (*P512Element) Set

func (e *P512Element) Set(t *P512Element) *P512Element

Set sets e = t, and returns e.

func (*P512Element) SetBytes

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

SetBytes sets e = v, where v is a big-endian 66-byte encoding, and returns e. If v is not 66 bytes or it encodes a value higher than 2^512 - 569, SetBytes returns nil and an error, and e is unchanged.

func (*P512Element) Square

func (e *P512Element) Square(t *P512Element) *P512Element

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

func (*P512Element) Sub

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

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