Documentation
¶
Overview ¶
Package snowfive implements the SNOW-V and SNOW-Vi synchronous stream ciphers.
Both variants provide confidentiality only. They do not authenticate ciphertext; applications that need integrity must use a separate, secure authentication construction. SNOW-V and SNOW-Vi keystreams are not interchangeable.
Index ¶
Constants ¶
const ( // KeySize is the SNOW-V and SNOW-Vi key size in bytes. KeySize = 32 // IVSize is the SNOW-V and SNOW-Vi initialization-vector size in bytes. IVSize = 16 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SnowVCipher ¶
type SnowVCipher struct {
// contains filtered or unexported fields
}
SnowVCipher is a SNOW-V stream cipher. A SnowVCipher must not be copied after first use, including by dereferencing it for formatting. Its methods are not safe for concurrent calls.
func NewSnowVCipher ¶
func NewSnowVCipher(key, iv []byte) (*SnowVCipher, error)
NewSnowVCipher constructs a SNOW-V stream cipher from a 32-byte key and a 16-byte initialization vector. It reads but does not retain key or iv. The caller must ensure that iv is unique for key.
func (*SnowVCipher) Destroy ¶
func (c *SnowVCipher) Destroy()
Destroy overwrites the cipher's live derived-key state and disables streaming until a successful Rekey. It is idempotent.
func (*SnowVCipher) Rekey ¶
func (c *SnowVCipher) Rekey(key, iv []byte) error
Rekey initializes a zero-value cipher or replaces a live or destroyed cipher's state with a new key and IV. This supports a Destroy-Put/Get-Rekey sync.Pool lifecycle. Invalid key or IV lengths leave the existing state unchanged. The caller must ensure that iv is unique for key.
func (*SnowVCipher) XORKeyStream ¶
func (c *SnowVCipher) XORKeyStream(dst, src []byte)
XORKeyStream XORs src with the cipher stream and writes the result to dst. Dst may be longer than src, but otherwise must overlap src exactly or not at all. XORKeyStream panics before initialization and after Destroy until a successful Rekey.
type SnowViCipher ¶
type SnowViCipher struct {
// contains filtered or unexported fields
}
SnowViCipher is a SNOW-Vi stream cipher. A SnowViCipher must not be copied after first use, including by dereferencing it for formatting. Its methods are not safe for concurrent calls.
func NewSnowViCipher ¶
func NewSnowViCipher(key, iv []byte) (*SnowViCipher, error)
NewSnowViCipher constructs a SNOW-Vi stream cipher from a 32-byte key and a 16-byte initialization vector. It reads but does not retain key or iv. The caller must ensure that iv is unique for key.
func (*SnowViCipher) Destroy ¶
func (c *SnowViCipher) Destroy()
Destroy overwrites the cipher's live derived-key state and disables streaming until a successful Rekey. It is idempotent.
func (*SnowViCipher) Rekey ¶
func (c *SnowViCipher) Rekey(key, iv []byte) error
Rekey initializes a zero-value cipher or replaces a live or destroyed cipher's state with a new key and IV. This supports a Destroy-Put/Get-Rekey sync.Pool lifecycle. Invalid key or IV lengths leave the existing state unchanged. The caller must ensure that iv is unique for key.
func (*SnowViCipher) XORKeyStream ¶
func (c *SnowViCipher) XORKeyStream(dst, src []byte)
XORKeyStream XORs src with the cipher stream and writes the result to dst. Dst may be longer than src, but otherwise must overlap src exactly or not at all. XORKeyStream panics before initialization and after Destroy until a successful Rekey.