rabbit

package module
v0.0.0-...-7e0a62a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 10, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

README

rabbit

It's a rabbit stream cipher packge based on RFC 4503 for golang
rabbit is a super-fast lightweight stream cipher which uses a 128-bit key and a 64-bit initialization vector, this cipher was designed in 2003 and released in 2008

this is a mirror repository, rabbitio also lives on snix.ir public git service

Note! The original package name rabbitio has been changed to rabbit.

Documentation

Index

Constants

View Source
const (
	KeyLen = 0x10
	IVXLen = 0x08
)

Variables

View Source
var (
	ErrInvalidKey = errors.New("rabbitio: rabbit key must be exactly 16 byte len")
	ErrInvalidIVX = errors.New("rabbitio: rabbit iv must be either 8 or zero byte len")
)

Functions

func NewCipher

func NewCipher(key []byte, iv []byte) (cipher.Stream, error)

NewCipher returns a chpher.Stream interface that implemented an XORKeyStream method according to RFC 4503, key must be 16 byte len, iv on the other hand is optional but must be either zero len or 8 byte len, error will be returned on wrong key/iv len

func NewReaderCipher

func NewReaderCipher(key []byte, iv []byte, re io.Reader) (*cipher.StreamReader, error)

NewWriterCipher warp a rabbit cipher stream with an io.Reader, returned StreamReader interface which can be used to encrypt or decrypting data

func NewWriterCipher

func NewWriterCipher(key []byte, iv []byte, wr io.Writer) (*cipher.StreamWriter, error)

NewWriterCipher warp a rabbit cipher stream with an io.Writer, returned StreamWriter interface which can be used to encrypt or decrypting data

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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