feistel

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

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

Go to latest
Published: May 13, 2019 License: MIT Imports: 4 Imported by: 0

README

go-feistel Travis Codecov GoDoc go-report

This package implements the Feistel cipher in go.
It contains the pure Feistel Encrypt/Decrypt functions as well as ECB and CBC implementations.

package main

import (
	"log"
	"github.com/Eun/go-feistel"
)

func main() {
	rounds := 2
	keys :=  []uint32{0xDEADBEEF, 0xFEEDFACE}
	secretText, err := feistel.ECB.Encrypt([]byte("Hello World"), rounds, keys)
	if err != nil {
		log.Fatal(err)
	}
	
	plainText, err := feistel.ECB.Decrypt(secretText, rounds, keys)
	if err != nil {
   		log.Fatal(err)
   	}
	
	log.Println(string(plainText))
}

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CBC cbc

CBC contains the Encrypt and Decrypt functions using the CBC algorithm

View Source
var ECB ecb

ECB contains the Encrypt and Decrypt functions using the ECB algorithm

Functions

func Decrypt

func Decrypt(left, right uint32, rounds int, keys []uint32) (uint32, uint32)

Decrypt takes a left and right uint32 and decrypts it using the Feistel cipher, it returns the decrypted left and right parts

func Encrypt

func Encrypt(left, right uint32, rounds int, keys []uint32) (uint32, uint32)

Encrypt takes a left and right uint32 and encrypts it using the Feistel cipher, it returns the encrypted left and right parts

Types

This section is empty.

Jump to

Keyboard shortcuts

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