fish

package module
v0.0.0-...-4b7a631 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2018 License: MIT Imports: 4 Imported by: 0

README

fish

Build Status

Implementation of FiSH IRC encryption in Go.

Installation

go get github.com/mpolden/fish

Usage

Basic example:

package main

import (
    "github.com/mpolden/fish"
    "log"
)

func main() {
    key := "secret key"
    message := "some message"

    enc, err := fish.Encrypt(key, message)
    if err != nil {
        log.Fatalf("Failed to encrypt: %s", err)
    }
    log.Printf("Encrypted: %s => %s", message, enc)

    dec, err := fish.Decrypt(key, enc)
    if err != nil {
        log.Fatalf("Failed to decrypt: %s", err)
    }
    log.Printf("Decrypted: %s => %s", enc, dec)
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Base64Decode

func Base64Decode(src []byte) ([]byte, error)

Base64Decode returns the bytes represented by base64 src

func Base64Encode

func Base64Encode(src []byte) string

Base64Encode returns a custom base64 encoding of src. If the size of src is not a multiple of 8, src will be padded with \x00 bytes

func Decrypt

func Decrypt(key string, message string) (string, error)

Decrypt returns the given message decrypted using key. If message does not have any encryption prefix, the message is returned unmodified.

func Encrypt

func Encrypt(key string, message string) (string, error)

Encrypt returns the given message encrypted using key. If the size of message is not a multiple of 8, message will be padded with \x00 bytes.

func IsEncrypted

func IsEncrypted(s string) bool

IsEncrypted returns true if the s has a valid encryption prefix.

Types

This section is empty.

Jump to

Keyboard shortcuts

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