Documentation ¶
Index ¶
- Constants
- Variables
- func AES_CBC_IV0_DECRYPT(K []byte, C []byte) []byte
- func AES_CBC_IV0_ENCRYPT(K []byte, M []byte) []byte
- func GCM_DECRYPT(K []byte, IV []byte, H []byte, C []byte) ([]byte, []byte)
- func GCM_ENCRYPT(K []byte, IV []byte, H []byte, P []byte) ([]byte, []byte)
- func GPhashit(hash int, hlen int, olen int, zpad int, A []byte, n int32, B []byte) []byte
- func HKDF_Expand(hash int, hlen int, olen int, PRK []byte, INFO []byte) []byte
- func HKDF_Extract(hash int, hlen int, SALT []byte, IKM []byte) []byte
- func HMAC(hash int, sha int, tag []byte, olen int, K []byte, M []byte) int
- func InttoBytes(n int, len int) []byte
- func KDF2(hash int, sha int, Z []byte, P []byte, olen int) []byte
- func MGF1(sha int, Z []byte, olen int, K []byte)
- func MGF1XOR(sha int, Z []byte, olen int, K []byte)
- func NHS_CLIENT(rng *RAND, SB []byte, UC []byte, KEY []byte)
- func NHS_SERVER_1(rng *RAND, SB []byte, S []byte)
- func NHS_SERVER_2(S []byte, UC []byte, KEY []byte)
- func PBKDF2(hash int, sha int, Pass []byte, Salt []byte, rep int, olen int) []byte
- func RSA_OAEP_DECODE(sha int, p []byte, f []byte, RFS int) []byte
- func RSA_OAEP_ENCODE(sha int, m []byte, rng *RAND, p []byte, RFS int) []byte
- func RSA_PKCS15(sha int, m []byte, w []byte, RFS int) bool
- func RSA_PKCS15b(sha int, m []byte, w []byte, RFS int) bool
- func RSA_PSS_ENCODE(sha int, m []byte, rng *RAND, RFS int) []byte
- func RSA_PSS_VERIFY(sha int, m []byte, f []byte) bool
- func Recover(S []*SHARE) []byte
- func SPhashit(hash int, hlen int, A []byte) []byte
- func XMD_Expand(hash int, hlen int, olen int, DST []byte, MSG []byte) []byte
- func XOF_Expand(hlen int, olen int, DST []byte, MSG []byte) []byte
- type AES
- type GCM
- type HASH256
- type HASH384
- type HASH512
- type RAND
- type SHA3
- func (H *SHA3) Continuing_Hash() []byte
- func (H *SHA3) Continuing_Shake(hash []byte, olen int)
- func (H *SHA3) Hash() []byte
- func (H *SHA3) Init(olen int)
- func (H *SHA3) Process(byt byte)
- func (H *SHA3) Process_array(b []byte)
- func (H *SHA3) Process_num(n int32)
- func (H *SHA3) Shake(hash []byte, olen int)
- func (H *SHA3) Squeeze(buff []byte, olen int)
- type SHARE
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 MC_SHA2 int = 2
View Source
const MC_SHA3 int = 3
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 */
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}
Functions ¶
func AES_CBC_IV0_DECRYPT ¶
returns plaintext if all consistent, else returns null string
func AES_CBC_IV0_ENCRYPT ¶
AES encryption/decryption. Encrypt byte array M using key K and returns ciphertext
func NHS_CLIENT ¶
optimized to reduce memory UC is U|cbar to be returned to server KEY is shared key
func NHS_SERVER_1 ¶
API functions. See https://eprint.iacr.org/2016/1157.pdf Protocol 1
S is secret key key, SB is seed|public key to be sent to client
func NHS_SERVER_2 ¶
calculate shared key from UC and secret key S
func PBKDF2 ¶
Password based Key Derivation Function Input password p, salt s, and repeat count Output key of length olen
func RSA_OAEP_DECODE ¶
OAEP Message Decoding for Decryption
func RSA_OAEP_ENCODE ¶
OAEP Message Encoding for Encryption
Types ¶
type AES ¶
type GCM ¶
type GCM struct { Y_0 [16]byte // contains filtered or unexported fields }
func (*GCM) Add_cipher ¶
Add Ciphertext - decrypts to plaintext
func (*GCM) Add_header ¶
Add Header data - included but not encrypted
type HASH256 ¶
type HASH256 struct {
// contains filtered or unexported fields
}
func NewHASH256 ¶
func NewHASH256() *HASH256
func NewHASH256copy ¶
func (*HASH256) Continuing_Hash ¶
type HASH384 ¶
type HASH384 struct {
// contains filtered or unexported fields
}
func NewHASH384 ¶
func NewHASH384() *HASH384
func NewHASH384copy ¶
func (*HASH384) Continuing_Hash ¶
type HASH512 ¶
type HASH512 struct {
// contains filtered or unexported fields
}
func NewHASH512 ¶
func NewHASH512() *HASH512
func NewHASH512copy ¶
func (*HASH512) Continuing_Hash ¶
type SHA3 ¶
type SHA3 struct {
// contains filtered or unexported fields
}
func NewSHA3copy ¶
func (*SHA3) Continuing_Hash ¶
func (*SHA3) Continuing_Shake ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.