Documentation ¶
Index ¶
- func AESCTRdecrypt(key []byte, ciphertext []byte) []byte
- func AESCTRencrypt(key []byte, plaintext []byte) []byte
- func AESECBencrypt(key []byte, plaintext []byte) []byte
- func AESGCMdecrypt(key []byte, ctWithNonce []byte) []byte
- func AESGCMencrypt(key []byte, plaintext []byte) []byte
- func Assert(condition bool)
- func BitsToBytes(b []int) []byte
- func BytesToBits(b []byte) []int
- func Concat(slices ...[]byte) []byte
- func ConcatP(pointers ...*[]byte) []byte
- func Contains(n int, h []int) bool
- func Decrypt(a, b []byte, t uint32, m []byte) []byte
- func Decrypt_generic(plaintext []byte, key []byte, nonce int) []byte
- func ECDSAPubkeyToPEM(key *ecdsa.PublicKey) []byte
- func ECDSASign(key *ecdsa.PrivateKey, items ...[]byte) []byte
- func Encrypt(a, b []byte, t uint32, m []byte) []byte
- func Encrypt_generic(plaintext []byte, key []byte, nonce int) []byte
- func ExpandRange(min int, max int) []int
- func FinishHash(outerState []byte, data []byte) []byte
- func Flatten(sos [][]byte) []byte
- func Generichash(length int, msg []byte) []byte
- func GetRandom(size int) []byte
- func Max(a, b int) int
- func RandInt(min, max int) int
- func RandString() string
- func Reverse(s []int) []int
- func Sha256(data []byte) []byte
- func SplitIntoChunks(data []byte, chunkSize int) [][]byte
- func To16Bytes(x *big.Int) []byte
- func To32Bytes(x *big.Int) []byte
- func XorBytes(a, b []byte) []byte
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AESCTRdecrypt ¶
AEC-CTR decrypt data, setting initial counter to 0
func AESCTRencrypt ¶
AEC-CTR encrypt data, setting initial counter to 0
func AESGCMdecrypt ¶
decrypt and reuse the ciphertext slice to put plaintext into it
func AESGCMencrypt ¶
func BitsToBytes ¶
convert an array of 0/1 with least bit at index 0 into bytes
func BytesToBits ¶
convert bytes into a 0/1 array with least bit at index 0
func ConcatP ¶
concatenate slices of bytes pointed to by pointers into a new slice with a new underlying array
func ECDSAPubkeyToPEM ¶
func Encrypt ¶
Based on the the A4 method from Fig.1 and the D4 method in Fig6 of the BHKR13 paper (https://eprint.iacr.org/2013/426.pdf) Note that the paper doesn't prescribe a specific method to break the symmerty between A and B, so we choose a circular byte shift instead of a circular bitshift as in Fig6.
func ExpandRange ¶
expand the range [min:max] into array of ints 1,2,3,4... up to but not including max
func FinishHash ¶
finishes sha256 hash from a previous mid-state
func Generichash ¶
port of sodium.crypto_generichash
func RandString ¶
func RandString() string
func SplitIntoChunks ¶
split a slice into smaller slices of size "chunkSize" each
Types ¶
This section is empty.