amcl

package
v0.0.0-...-9e02669 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2023 License: Apache-2.0 Imports: 1 Imported by: 498

Documentation

Index

Constants

View Source
const AES_CBC int = 1
View Source
const AES_CFB1 int = 2
View Source
const AES_CFB2 int = 3
View Source
const AES_CFB4 int = 5
View Source
const AES_CTR1 int = 30
View Source
const AES_CTR16 int = 45
View Source
const AES_CTR2 int = 31
View Source
const AES_CTR4 int = 33
View Source
const AES_CTR8 int = 37
View Source
const AES_ECB int = 0
View Source
const AES_OFB1 int = 14
View Source
const AES_OFB16 int = 29
View Source
const AES_OFB2 int = 15
View Source
const AES_OFB4 int = 17
View Source
const AES_OFB8 int = 21
View Source
const GCM_ACCEPTING_CIPHER int = 1
View Source
const GCM_ACCEPTING_HEADER int = 0
View Source
const GCM_DECRYPTING int = 1
View Source
const GCM_ENCRYPTING int = 0
View Source
const GCM_FINISHED int = 3
View Source
const GCM_NOT_ACCEPTING_MORE int = 2
View Source
const NHS_DEGREE int = (1 << NHS_LGN)
View Source
const NHS_LGN uint = 10 // Degree n=2^LGN
View Source
const NHS_ND uint32 = 0xF7002FFF // 1/(R-q) mod R
View Source
const NHS_ONE int32 = 0x2AC8 // R mod q
View Source
const NHS_PRIME int32 = 0x3001 // q in Hex
View Source
const NHS_R2MODP uint64 = 0x1620 // R^2 mod q
View Source
const NHS_WL uint = 32
View Source
const NHS_inv int32 = 0xeab
View Source
const NHS_invpr int32 = 0x2c2a
View Source
const SHA256 int = 32

import "fmt"

View Source
const SHA384 int = 48
View Source
const SHA3_HASH224 int = 28
View Source
const SHA3_HASH256 int = 32
View Source
const SHA3_HASH384 int = 48
View Source
const SHA3_HASH512 int = 64
View Source
const SHA3_SHAKE128 int = 16
View Source
const SHA3_SHAKE256 int = 32
View Source
const SHA512 int = 64

Variables

View Source
var NHS_iroots = [1024]int32{} /* 1024 elements not displayed */
View Source
var NHS_roots = [1024]int32{} /* 1024 elements not displayed */

Functions

func NHS_CLIENT

func NHS_CLIENT(rng *RAND, SB []byte, UC []byte, KEY []byte)

func NHS_SERVER_1

func NHS_SERVER_1(rng *RAND, SB []byte, S []byte)

func NHS_SERVER_2

func NHS_SERVER_2(S []byte, UC []byte, KEY []byte)

Types

type AES

type AES struct {
	Nk int
	Nr int
	// contains filtered or unexported fields
}

func NewAES

func NewAES() *AES

func (*AES) Decrypt

func (A *AES) Decrypt(buff []byte) uint32

Decrypt using selected mode of operation

func (*AES) Encrypt

func (A *AES) Encrypt(buff []byte) uint32

Encrypt using selected mode of operation

func (*AES) End

func (A *AES) End()

Clean up and delete left-overs

func (*AES) Getreg

func (A *AES) Getreg() [16]byte

func (*AES) Init

func (A *AES) Init(m int, nk int, key []byte, iv []byte) bool

func (*AES) Reset

func (A *AES) Reset(m int, iv []byte)

reset cipher

type GCM

type GCM struct {
	Y_0 [16]byte
	// contains filtered or unexported fields
}

func (*GCM) Add_cipher

func (G *GCM) Add_cipher(cipher []byte, len int) []byte

Add Ciphertext - decrypts to plaintext

func (*GCM) Add_header

func (G *GCM) Add_header(header []byte, len int) bool

Add Header data - included but not encrypted

func (*GCM) Add_plain

func (G *GCM) Add_plain(plain []byte, len int) []byte

Add Plaintext - included and encrypted

func (*GCM) Finish

func (G *GCM) Finish(extract bool) [16]byte

Finish and extract Tag

func (*GCM) Init

func (G *GCM) Init(nk int, key []byte, niv int, iv []byte)

Initialize GCM mode

type HASH256

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

func NewHASH256

func NewHASH256() *HASH256

func (*HASH256) Hash

func (H *HASH256) Hash() []byte

Generate 32-byte Hash

func (*HASH256) Init

func (H *HASH256) Init()

Initialise Hash function

func (*HASH256) Process

func (H *HASH256) Process(byt byte)

process a single byte

func (*HASH256) Process_array

func (H *HASH256) Process_array(b []byte)

process an array of bytes

func (*HASH256) Process_num

func (H *HASH256) Process_num(n int32)

process a 32-bit integer

type HASH384

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

func NewHASH384

func NewHASH384() *HASH384

func (*HASH384) Hash

func (H *HASH384) Hash() []byte

Generate 32-byte Hash

func (*HASH384) Init

func (H *HASH384) Init()

Initialise Hash function

func (*HASH384) Process

func (H *HASH384) Process(byt byte)

process a single byte

func (*HASH384) Process_array

func (H *HASH384) Process_array(b []byte)

process an array of bytes

func (*HASH384) Process_num

func (H *HASH384) Process_num(n int32)

process a 32-bit integer

type HASH512

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

func NewHASH512

func NewHASH512() *HASH512

func (*HASH512) Hash

func (H *HASH512) Hash() []byte

Generate 64-byte Hash

func (*HASH512) Init

func (H *HASH512) Init()

Initialise Hash function

func (*HASH512) Process

func (H *HASH512) Process(byt byte)

process a single byte

func (*HASH512) Process_array

func (H *HASH512) Process_array(b []byte)

process an array of bytes

func (*HASH512) Process_num

func (H *HASH512) Process_num(n int32)

process a 32-bit integer

type RAND

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

func NewRAND

func NewRAND() *RAND

func (*RAND) Clean

func (R *RAND) Clean()

Terminate and clean up

func (*RAND) GetByte

func (R *RAND) GetByte() byte

get random byte

func (*RAND) Seed

func (R *RAND) Seed(rawlen int, raw []byte)

Initialize RNG with some real entropy from some external source

type SHA3

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

func NewSHA3

func NewSHA3(olen int) *SHA3

func (*SHA3) Hash

func (H *SHA3) Hash(hash []byte)

Generate Hash

func (*SHA3) Init

func (H *SHA3) Init(olen int)

Initialise Hash function

func (*SHA3) Process

func (H *SHA3) Process(byt byte)

process a single byte

func (*SHA3) Shake

func (H *SHA3) Shake(hash []byte, olen int)

func (*SHA3) Squeeze

func (H *SHA3) Squeeze(buff []byte, olen int)

squeeze the sponge

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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