cipher

module
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2018 License: MIT

README

Cipher

Build Status Code Coverage

Ciphers is a just for fun project, created to provide some encryption methods not implemented in the standard crypto/cipher package. For now, only the Caesar cipher is available as Go package.

Installation

$ go get github.com/rvflash/cipher

Quick start

If you just need a Go package to play with the Caesar code, see the example bellow :

import (
	"fmt"
	"github.com/rvflash/cipher/caesar"
)
// ...
r := strings.NewReader("Hello World!")
b, _ := caesar.ROT13.Encrypt(r)
fmt.Printf("%s", b)
// output: Uryyb Jbeyq!

As you can see, you can directly use the most famous version of the Caesar cipher, the ROT13 (rotates by 13 places).

In addiction of the caesar.ROT13, you can create your own Caesar cipher with the caesar.Classic method. It takes as first parameter the number of letter to use as key. Finally, the caesar.New method uses the same algorithm but don't limit the code to the letters of the alphabet. It uses all printable ASCII characters.

If you just want to play with it in your browser, you can start the HTTP server on https://localhost:4433.

$ cd $GOPATH/github.com/rvflash/cipher/cmd/cipher
$ go build && ./cipher

Caesar cipher

In cryptography, a Caesar cipher is one of the simplest encryption techniques. It is a type of substitution cipher in which each letter in the plaintext is replaced by a letter some fixed number of positions down the alphabet.

See the documentation for more details about the interface.

ROT13

It's the most known version of letter substitution cipher. It replaces a letter with the 13th letter after it. The variable caesar.ROT13 gives you a direct access tu use it.

Directories

Path Synopsis
Package caesar provides interface to encrypt and decrypt Caesar cipher.
Package caesar provides interface to encrypt and decrypt Caesar cipher.
cmd

Jump to

Keyboard shortcuts

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