fish

package module
v0.0.0-...-f44f8c7 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2021 License: MIT Imports: 7 Imported by: 0

README

Fish

GoDoc

Fish is a Go implementation for IRC FiSH encryption. It uses the Blowfish cipher to encrypt/decrypt messages in EBC and CBC modes based on a symmetric key.

It calls ciphers from the Go standard library and sub-repositories, handles base64 encoding and irc message parsing.

The EBC implementation is based off the original FiSH-irssi source, see BASE64.md for an explanation of the unique base64 encoding scheme.

The CBC implementation is based off the extension of FiSH-irssi by falsovsky for compatibility with mircryption.

To use CBC mode the key must be prepended with cbc:

Documentation

Index

Constants

View Source
const (
	CBCPrefixOK   = "+OK *"
	CBCPrefixMCPS = "mcps *"
)

CBC message prefixes.

View Source
const (
	EBCPrefixOK   = "+OK "
	EBCPrefixMCPS = "mcps "
)

EBC message prefixes.

View Source
const KeyPrefixCBC = "cbc:"

KeyPrefixCBC is the key prefix required to specify CBC mode.

Variables

This section is empty.

Functions

This section is empty.

Types

type Fish

type Fish struct {
	// contains filtered or unexported fields
}

Fish is an IRC Blowfish encryption cipher using a specific key and block mode.

func NewFish

func NewFish(key string) (*Fish, error)

NewFish creates and returns a Fish for the specified key. To use CBC block mode the key must be prepended with "cbc:". Fails if the key is invalid.

func (*Fish) Decrypt

func (f *Fish) Decrypt(msg string) (string, error)

Decrypt decrypts the specified msg and returns it. Fails for CBC mode if the decrypted string cannot be decoded.

func (*Fish) Encrypt

func (f *Fish) Encrypt(msg string) (string, error)

Encrypt encrypts the specified msg and returns it. Fails for CBC mode if random bytes cannot be prepended to the message.

func (*Fish) UpdateKey

func (f *Fish) UpdateKey(key string) error

UpdateKey updates the Fish based on the new key. To use CBC block mode the key must be prepended with "cbc:". Fails if the key is invalid.

Jump to

Keyboard shortcuts

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