core

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: 10

Documentation

Overview

  • Copyright (c) 2012-2020 MIRACL UK Ltd. *

  • This file is part of MIRACL Core

  • (see https://github.com/miracl/core). *

  • 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.

    Arwa Alblooshi 15/12/2022

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 DL_COMBO = 0xA3FA // ONE*inv mod Q
View Source
const DL_D = 13
View Source
const DL_DEGREE = (1 << DL_LGN)
View Source
const DL_LGN = 8

q = 8380417

View Source
const DL_MAXK = 8 // could reduce these if not using highest security
View Source
const DL_MAXL = 7
View Source
const DL_MAXLG = 19
View Source
const DL_ND = 0xFC7FDFFF // 1/(R-Q) mod R
View Source
const DL_ONE = 0x3FFE00 // R mod Q
View Source
const DL_PK_SIZE_2 = ((4*DL_DEGREE*DL_TD)/8 + 32)
View Source
const DL_PK_SIZE_3 = ((6*DL_DEGREE*DL_TD)/8 + 32)
View Source
const DL_PK_SIZE_5 = ((8*DL_DEGREE*DL_TD)/8 + 32)
View Source
const DL_PRIME = 0x7fe001
View Source
const DL_R2MODP = 0x2419FF // R^2 mod Q
View Source
const DL_SIG_SIZE_2 = ((DL_DEGREE*4*(17+1))/8 + 80 + 4 + 32)
View Source
const DL_SIG_SIZE_3 = ((DL_DEGREE*5*(19+1))/8 + 55 + 6 + 32)
View Source
const DL_SIG_SIZE_5 = ((DL_DEGREE*7*(19+1))/8 + 75 + 8 + 32)
View Source
const DL_SK_SIZE_2 = (32*3 + DL_DEGREE*(4*13+4*3+4*3)/8)
View Source
const DL_SK_SIZE_3 = (32*3 + DL_DEGREE*(6*13+5*4+6*4)/8)
View Source
const DL_SK_SIZE_5 = (32*3 + DL_DEGREE*(8*13+7*3+8*3)/8)
View Source
const DL_TD = (23 - DL_D)
View Source
const DL_YBYTES = (((DL_MAXLG + 1) * DL_DEGREE) / 8)
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 KYBER_CIPHERTEXT_SIZE_1024 int = ((11*4 + 5) * KY_DEGREE / 8)
View Source
const KYBER_CIPHERTEXT_SIZE_512 int = ((10*2 + 4) * KY_DEGREE / 8)
View Source
const KYBER_CIPHERTEXT_SIZE_768 int = ((10*3 + 4) * KY_DEGREE / 8)
View Source
const KYBER_PUBLIC_SIZE_1024 int = (32 + 4*(KY_DEGREE*3)/2)
View Source
const KYBER_PUBLIC_SIZE_512 int = (32 + 2*(KY_DEGREE*3)/2)
View Source
const KYBER_PUBLIC_SIZE_768 int = (32 + 3*(KY_DEGREE*3)/2)
View Source
const KYBER_SECRET_CCA_SIZE_1024 int = (KYBER_SECRET_CPA_SIZE_1024 + KYBER_PUBLIC_SIZE_1024 + 64)
View Source
const KYBER_SECRET_CCA_SIZE_512 int = (KYBER_SECRET_CPA_SIZE_512 + KYBER_PUBLIC_SIZE_512 + 64)
View Source
const KYBER_SECRET_CCA_SIZE_768 int = (KYBER_SECRET_CPA_SIZE_768 + KYBER_PUBLIC_SIZE_768 + 64)
View Source
const KYBER_SECRET_CPA_SIZE_1024 int = (4 * (KY_DEGREE * 3) / 2)
View Source
const KYBER_SECRET_CPA_SIZE_512 int = (2 * (KY_DEGREE * 3) / 2)
View Source
const KYBER_SECRET_CPA_SIZE_768 int = (3 * (KY_DEGREE * 3) / 2)
View Source
const KYBER_SHARED_SECRET_1024 int = 32
View Source
const KYBER_SHARED_SECRET_512 int = 32
View Source
const KYBER_SHARED_SECRET_768 int = 32
View Source
const KY_DEGREE int = (1 << KY_LGN)
View Source
const KY_LGN uint = 8
View Source
const KY_MAXK = 4
View Source
const KY_ONE int32 = 0x549 // R mod Q
View Source
const KY_PRIME int32 = 0xD01
View Source
const KY_QINV int32 = 62209 // q^(-1) mod 2^16
View Source
const MC_SHA2 int = 2
View Source
const MC_SHA3 int = 3
View Source
const NTTL = 1

Gentleman-Sande INTT Excess of 2 allowed on input - coefficients must be < 2*PRIME Output fully reduced

View Source
const SHA256 int = 32
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 DL_PARAMS_2 = []int{39, 17, 88, 4, 4, 2, 3, 80}
View Source
var DL_PARAMS_3 = []int{49, 19, 32, 6, 5, 4, 4, 55}
View Source
var DL_PARAMS_5 = []int{60, 19, 32, 8, 7, 2, 3, 75}
View Source
var DL_iroots = []int32{} /* 256 elements not displayed */
View Source
var DL_roots = []int32{} /* 256 elements not displayed */
View Source
var PARAMS_1024 = [6]int{4, 2, 2, 11, 5, 32}
View Source
var PARAMS_512 = [6]int{2, 3, 2, 10, 4, 32}

parameters for each security level K,eta1,eta2,du,dv,shared secret

View Source
var PARAMS_768 = [6]int{3, 2, 2, 10, 4, 32}
View Source
var SHA256ID = [...]byte{0x30, 0x31, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x01, 0x05, 0x00, 0x04, 0x20}

SHAXXX identifier strings

View Source
var SHA256IDb = [...]byte{0x30, 0x2f, 0x30, 0x0b, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x01, 0x04, 0x20}

SHAXXX identifier strings

View Source
var SHA384ID = [...]byte{0x30, 0x41, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x02, 0x05, 0x00, 0x04, 0x30}
View Source
var SHA384IDb = [...]byte{0x30, 0x3f, 0x30, 0x0b, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x02, 0x04, 0x30}
View Source
var SHA512ID = [...]byte{0x30, 0x51, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x03, 0x05, 0x00, 0x04, 0x40}
View Source
var SHA512IDb = [...]byte{0x30, 0x4f, 0x30, 0x0b, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x03, 0x04, 0x40}
View Source
var ZETAS = [256]int16{}/* 128 elements not displayed */

Translated from public domain reference implementation code - taken from https://github.com/pq-crystals/kyber

Functions

func AES_CBC_IV0_DECRYPT

func AES_CBC_IV0_DECRYPT(K []byte, C []byte) []byte

returns plaintext if all consistent, else returns null string

func AES_CBC_IV0_ENCRYPT

func AES_CBC_IV0_ENCRYPT(K []byte, M []byte) []byte

AES encryption/decryption. Encrypt byte array M using key K and returns ciphertext

func DL_CRH1

func DL_CRH1(params []int, H []byte, rho []byte, t1 [][DL_DEGREE]int16)

CRH(rho,t1)

func DL_CRH2

func DL_CRH2(H []byte, tr []byte, mess []byte, mlen int)

CRH(tr,M)

func DL_CRH3

func DL_CRH3(H []byte, bK []byte, mu []byte)

CRH(K,mu)

func DL_ExpandAij

func DL_ExpandAij(rho []byte, Aij []int32, i int, j int)

Generate A[i][j] from rho

func DL_H4

func DL_H4(params []int, CT []byte, mu []byte, w1 [][DL_DEGREE]int8)

H(mu,w1)

func DL_MakePartialHint

func DL_MakePartialHint(params []int, h []byte, hptr int, z []int32, r []int32) int

before h initialised to zeros, hptr=0 after new hptr returned and h[OMEGA+i]= hptr

func DL_Power2Round

func DL_Power2Round(t []int32, t0 []int16, t1 []int16)

func DL_SampleInBall

func DL_SampleInBall(params []int, ct []byte, c []int32)

func DL_UsePartialHint

func DL_UsePartialHint(params []int, r []int8, h []byte, hptr int, i int, w []int32) int

func DL_decompose_hi

func DL_decompose_hi(params []int, a int32) int8

ALPHA = (Q-1)/16

func DL_decompose_lo

func DL_decompose_lo(params []int, a int32) int32

ALPHA = (Q-1)/16 - borrowed from dilithium ref implementation

func DL_hibits

func DL_hibits(params []int, r1 []int8, r []int32)

func DL_infinity_norm

func DL_infinity_norm(w []int32) int32

func DL_intt

func DL_intt(x []int32)

func DL_keypair

func DL_keypair(params []int, tau []byte, sk []byte, pk []byte)

Dilithium API

func DL_keypair_2

func DL_keypair_2(tau []byte, sk []byte, pk []byte)

func DL_keypair_3

func DL_keypair_3(tau []byte, sk []byte, pk []byte)

func DL_keypair_5

func DL_keypair_5(tau []byte, sk []byte, pk []byte)

func DL_lobits

func DL_lobits(params []int, r0 []int32, r []int32)

func DL_modmul

func DL_modmul(a uint32, b uint32) int32

func DL_nabs

func DL_nabs(x int32) int32

constant time absolute vaue

func DL_nextbyte16

func DL_nextbyte16(ab int, max int, t []int16, position []int) byte

array t has ab active bits per word extract dense bytes from array of words if max!=0 then -max<=t[i]<=+max

func DL_nextbyte32

func DL_nextbyte32(ab int, max int, t []int32, position []int) byte

array t has ab active bits per word extract bytes from array of words if max!=0 then -max<=t[i]<=+max

func DL_nextbyte8

func DL_nextbyte8(ab int, max int, t []int8, position []int) byte

array t has ab active bits per word extract dense bytes from array of words if max!=0 then -max<=t[i]<=+max

func DL_nextword

func DL_nextword(ab int, max int, t []byte, position []int) int32

extract ab bits into word from dense byte stream

func DL_nres

func DL_nres(x uint32) int32

func DL_nres_it

func DL_nres_it(p []int32)

func DL_ntt

func DL_ntt(x []int32)

func DL_pack_pk

func DL_pack_pk(params []int, pk []byte, rho []byte, t1 [][DL_DEGREE]int16) int

pack public key

func DL_pack_sig

func DL_pack_sig(params []int, sig []byte, z [][DL_DEGREE]int32, ct []byte, h []byte) int

pack signature - change z

func DL_pack_sk

func DL_pack_sk(params []int, sk []byte, rho []byte, bK []byte, tr []byte, s1 [][DL_DEGREE]int8, s2 [][DL_DEGREE]int8, t0 [][DL_DEGREE]int16) int

secret key of size 32*3+DEGREE*(K*D+L*LG2ETA1+K*LG2ETA1)/8

func DL_poly_add

func DL_poly_add(p1 []int32, p2 []int32, p3 []int32)

func DL_poly_copy

func DL_poly_copy(p1 []int32, p2 []int32)

copy polynomial

func DL_poly_hard_reduce

func DL_poly_hard_reduce(poly []int32)

fully reduces modulo q

func DL_poly_mcopy

func DL_poly_mcopy(p1 []int32, p2 []int16)

copy from medium polynomial

func DL_poly_mul

func DL_poly_mul(p1 []int32, p2 []int32, p3 []int32)

func DL_poly_negate

func DL_poly_negate(p1 []int32, p2 []int32)

func DL_poly_pos

func DL_poly_pos(p []int32)

make all elements +ve

func DL_poly_scopy

func DL_poly_scopy(p1 []int32, p2 []int8)

copy from small polynomial

func DL_poly_soft_reduce

func DL_poly_soft_reduce(poly []int32)

reduce inputs that are already < 2q

func DL_poly_sub

func DL_poly_sub(p1 []int32, p2 []int32, p3 []int32)

func DL_poly_zero

func DL_poly_zero(p1 []int32)

func DL_redc

func DL_redc(T uint64) int32

Montgomery stuff

func DL_redc_it

func DL_redc_it(p []int32)

func DL_round

func DL_round(a int32, b int32) int32

func DL_sample_Sn

func DL_sample_Sn(params []int, rhod []byte, s []int8, n int)

rejection sampling in range -ETA to +ETA

func DL_sample_Y

func DL_sample_Y(params []int, k int, rhod []byte, y [][DL_DEGREE]int32)

uniform random sampling

func DL_signature

func DL_signature(params []int, sk []byte, M []byte, sig []byte) int

func DL_signature_2

func DL_signature_2(sk []byte, M []byte, sig []byte) int

func DL_signature_3

func DL_signature_3(sk []byte, M []byte, sig []byte) int

func DL_signature_5

func DL_signature_5(sk []byte, M []byte, sig []byte) int

func DL_unpack_pk

func DL_unpack_pk(params []int, rho []byte, t1 [][DL_DEGREE]int16, pk []byte)

unpack public key

func DL_unpack_sig

func DL_unpack_sig(params []int, z [][DL_DEGREE]int32, ct []byte, h []byte, sig []byte)

func DL_unpack_sk

func DL_unpack_sk(params []int, rho []byte, bK []byte, tr []byte, s1 [][DL_DEGREE]int8, s2 [][DL_DEGREE]int8, t0 [][DL_DEGREE]int16, sk []byte)

func DL_verify

func DL_verify(params []int, pk []byte, M []byte, sig []byte) bool

func DL_verify_2

func DL_verify_2(pk []byte, M []byte, sig []byte) bool

func DL_verify_3

func DL_verify_3(pk []byte, M []byte, sig []byte) bool

func DL_verify_5

func DL_verify_5(pk []byte, M []byte, sig []byte) bool

func GCM_DECRYPT

func GCM_DECRYPT(K []byte, IV []byte, H []byte, C []byte) ([]byte, []byte)

func GCM_ENCRYPT

func GCM_ENCRYPT(K []byte, IV []byte, H []byte, P []byte) ([]byte, []byte)

func GPhashit

func GPhashit(hash int, hlen int, olen int, zpad int, A []byte, n int32, B []byte) []byte

func HKDF_Expand

func HKDF_Expand(hash int, hlen int, olen int, PRK []byte, INFO []byte) []byte

func HKDF_Extract

func HKDF_Extract(hash int, hlen int, SALT []byte, IKM []byte) []byte

func HMAC

func HMAC(hash int, sha int, tag []byte, olen int, K []byte, M []byte) int

Calculate HMAC of m using key k. HMAC is tag of length olen (which is length of tag)

func InttoBytes

func InttoBytes(n int, len int) []byte

Convert Integer to n-byte array

func KDF2

func KDF2(hash int, sha int, Z []byte, P []byte, olen int) []byte

func KYBER_decrypt1024

func KYBER_decrypt1024(SK []byte, CT []byte, SS []byte)

func KYBER_decrypt512

func KYBER_decrypt512(SK []byte, CT []byte, SS []byte)

func KYBER_decrypt768

func KYBER_decrypt768(SK []byte, CT []byte, SS []byte)

func KYBER_encrypt1024

func KYBER_encrypt1024(r32 []byte, PK []byte, SS []byte, CT []byte)

func KYBER_encrypt512

func KYBER_encrypt512(r32 []byte, PK []byte, SS []byte, CT []byte)

func KYBER_encrypt768

func KYBER_encrypt768(r32 []byte, PK []byte, SS []byte, CT []byte)

func KYBER_keypair1024

func KYBER_keypair1024(r64 []byte, SK []byte, PK []byte)

func KYBER_keypair512

func KYBER_keypair512(r64 []byte, SK []byte, PK []byte)

func KYBER_keypair768

func KYBER_keypair768(r64 []byte, SK []byte, PK []byte)

func MGF1

func MGF1(sha int, Z []byte, olen int, K []byte)

func MGF1XOR

func MGF1XOR(sha int, Z []byte, olen int, K []byte)

func PBKDF2

func PBKDF2(hash int, sha int, Pass []byte, Salt []byte, rep int, olen int) []byte

Password based Key Derivation Function Input password p, salt s, and repeat count Output key of length olen

func RSA_OAEP_DECODE

func RSA_OAEP_DECODE(sha int, p []byte, f []byte, RFS int) []byte

OAEP Message Decoding for Decryption

func RSA_OAEP_ENCODE

func RSA_OAEP_ENCODE(sha int, m []byte, rng *RAND, p []byte, RFS int) []byte

OAEP Message Encoding for Encryption

func RSA_PKCS15

func RSA_PKCS15(sha int, m []byte, w []byte, RFS int) bool

func RSA_PKCS15b

func RSA_PKCS15b(sha int, m []byte, w []byte, RFS int) bool

func RSA_PSS_ENCODE

func RSA_PSS_ENCODE(sha int, m []byte, rng *RAND, RFS int) []byte

func RSA_PSS_VERIFY

func RSA_PSS_VERIFY(sha int, m []byte, f []byte) bool

func Recover

func Recover(S []*SHARE) []byte

recover M from shares

func SPhashit

func SPhashit(hash int, hlen int, A []byte) []byte

Simple hashing of byte array

func XMD_Expand

func XMD_Expand(hash int, hlen int, olen int, DST []byte, MSG []byte) []byte

func XOF_Expand

func XOF_Expand(hlen int, olen int, DST []byte, MSG []byte) []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) []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 NewHASH256copy

func NewHASH256copy(HC *HASH256) *HASH256

func (*HASH256) Continuing_Hash

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

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 NewHASH384copy

func NewHASH384copy(HC *HASH384) *HASH384

func (*HASH384) Continuing_Hash

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

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 NewHASH512copy

func NewHASH512copy(HC *HASH512) *HASH512

func (*HASH512) Continuing_Hash

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

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 NewSHA3copy

func NewSHA3copy(HC *SHA3) *SHA3

func (*SHA3) Continuing_Hash

func (H *SHA3) Continuing_Hash() []byte

func (*SHA3) Continuing_Shake

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

func (*SHA3) Hash

func (H *SHA3) 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) Process_array

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

process an array of bytes

func (*SHA3) Process_num

func (H *SHA3) Process_num(n int32)

process a 32-bit integer

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

type SHARE

type SHARE struct {
	ID  byte   // Unique Share ID
	NSR byte   // Number of Shares required for recovery
	B   []byte // Share
}

func NewSHARE

func NewSHARE(id int, nsr int, M []byte, R []byte) *SHARE

Return a share of M input id - Unique share ID input nsr - Number of shares required for recovery input Message M to be shared input Random seed R return share structure

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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