https://github.com/rvflash/cipher
Cipher implements some encryption techniques
https://github.com/rvflash/cipher
caesar-cipher golang
Last synced: 2 months ago
JSON representation
Cipher implements some encryption techniques
- Host: GitHub
- URL: https://github.com/rvflash/cipher
- Owner: rvflash
- License: mit
- Created: 2018-07-29T11:19:58.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2018-07-29T14:15:20.000Z (almost 7 years ago)
- Last Synced: 2025-01-28T16:16:29.985Z (4 months ago)
- Topics: caesar-cipher, golang
- Language: Go
- Homepage:
- Size: 14.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Cipher
[](https://travis-ci.org/rvflash/cipher)
[](http://codecov.io/github/rvflash/cipher?branch=master)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](https://github.com/rvflash/cipher/tree/master/caesar) is available as Go package.## Installation
```bash
$ 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 :
```go
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.
```bash
$ 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](https://godoc.org/github.com/rvflash/cipher/caesar) 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.