Documentation
¶
Index ¶
- func NewECPointReader(r io.Reader) *pointReader
- func NewECPointWriter(w io.Writer) *pointWriter
- func PseudorandomCode(aesBlock cipher.Block, src []byte, hIdx byte) []byte
- func PseudorandomGenerate(dst []byte, seed []byte, h *blake3.Hasher) error
- func XorCipherWithBlake3(key []byte, ind byte, src []byte) []byte
- type Point
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewECPointReader ¶
NewECPointReader returns an elliptic curve point reader
func NewECPointWriter ¶
NewECPointWriter returns an elliptic curve point writer
func PseudorandomCode ¶
PseudorandomCode is implemented as follows: C(x) = AES(1||h(x)[:15]) ||
AES(2||h(x)[:15]) || AES(3||h(x)[:15]) || AES(4||h(x)[:15])
where h() is the Murmur3 hashing function. PseudorandomCode is passed the src as well as the associated hash index. It also requires an AES block cipher. The full pseudorandom code consists of four 16 byte encrypted AES blocks that are encoded into a slice of 64 bytes. The hash function is constructed with the hash index as its two seeds. It is fed the full ID source. It returns two uint64s which are cast to a slice of bytes. The output is shifted right to allow prepending of the block index. For each block, the prepended value is changed to indicate the block index (1, 2, 3, 4) before being used as the source for the AES encode.
func PseudorandomGenerate ¶
PseudorandomGenerate is a pseudorandom generator (PRG) using a deterministic random bit generator (DRBG) as specified by NIST - Special Publication 800-90A Revision 1. Blake3 is not normally used as a DRBG but we've applied it here for performance reasons.
Types ¶
type Point ¶
type Point struct {
// contains filtered or unexported fields
}
Point represents a point on the P256 elliptic curve
func GenerateKey ¶
GenerateKey returns a secret and public key pair
func (*Point) DeriveKeyFromECPoint ¶
DeriveKeyFromECPoint returns a key of 32 byte
func (*Point) ScalarMult ¶
ScalarMult multiplies a point with a scalar