GithubHelp home page GithubHelp logo

chacha20's Introduction

Godoc Reference Build Status Go Report Card

The ChaCha20 stream cipher

ChaCha is a stream cipher family created by Daniel J. Bernstein.
The most common ChaCha variant is ChaCha20 (20 rounds). ChaCha20 is standardized in RFC 7539.

This package provides implementations of three ChaCha versions:

  • ChaCha20 with a 64 bit nonce (can en/decrypt up to 2^64 * 64 bytes for one key-nonce combination)
  • ChaCha20 with a 96 bit nonce (can en/decrypt up to 2^32 * 64 bytes ~ 256 GB for one key-nonce combination)
  • XChaCha20 with a 192 bit nonce (can en/decrypt up to 2^64 * 64 bytes for one key-nonce combination)

Furthermore the chacha sub package implements ChaCha20/12 and ChaCha20/8. These versions use 12 or 8 rounds instead of 20. But it's recommended to use ChaCha20 (with 20 rounds) - it will be fast enough for almost all purposes.

Installation

Install in your GOPATH: go get -u github.com/aead/chacha20

Requirements

All go versions >= 1.8.7 are supported. The code may also work on Go 1.7 but this is not tested.

Performance

AMD64

Hardware: Intel i7-6500U 2.50GHz x 2
System: Linux Ubuntu 16.04 - kernel: 4.4.0-62-generic
Go version: 1.8.0

AVX2
name                        speed              cpb
ChaCha20_64-4                573MB/s ± 0%      4.16
ChaCha20_1K-4               2.19GB/s ± 0%      1.06
XChaCha20_64-4               261MB/s ± 0%      9.13
XChaCha20_1K-4              1.69GB/s ± 4%      1.37
XORKeyStream64-4             474MB/s ± 2%      5.02
XORKeyStream1K-4            2.09GB/s ± 1%      1.11
XChaCha20_XORKeyStream64-4   262MB/s ± 0%      9.09
XChaCha20_XORKeyStream1K-4  1.71GB/s ± 1%      1.36

SSSE3
name                        speed              cpb
ChaCha20_64-4                583MB/s ± 0%      4.08
ChaCha20_1K-4               1.15GB/s ± 1%      2.02
XChaCha20_64-4               267MB/s ± 0%      8.92
XChaCha20_1K-4               984MB/s ± 5%      2.42
XORKeyStream64-4             492MB/s ± 1%      4.84
XORKeyStream1K-4            1.10GB/s ± 5%      2.11
XChaCha20_XORKeyStream64-4   266MB/s ± 0%      8.96
XChaCha20_XORKeyStream1K-4  1.00GB/s ± 2%      2.32

386

Hardware: Intel i7-6500U 2.50GHz x 2
System: Linux Ubuntu 16.04 - kernel: 4.4.0-62-generic
Go version: 1.8.0

SSSE3
name                        speed              cpb
ChaCha20_64-4               570MB/s ± 0%       4.18
ChaCha20_1K-4               650MB/s ± 0%       3.66
XChaCha20_64-4              223MB/s ± 0%      10.69
XChaCha20_1K-4              584MB/s ± 1%       4.08
XORKeyStream64-4            392MB/s ± 1%       6.08
XORKeyStream1K-4            629MB/s ± 1%       3.79
XChaCha20_XORKeyStream64-4  222MB/s ± 0%      10.73
XChaCha20_XORKeyStream1K-4  585MB/s ± 0%       4.07

SSE2
name                        speed              cpb
ChaCha20_64-4               509MB/s ± 0%       4.68
ChaCha20_1K-4               553MB/s ± 2%       4.31
XChaCha20_64-4              201MB/s ± 0%      11.86
XChaCha20_1K-4              498MB/s ± 4%       4.78
XORKeyStream64-4            359MB/s ± 1%       6.64
XORKeyStream1K-4            545MB/s ± 0%       4.37
XChaCha20_XORKeyStream64-4  201MB/s ± 1%      11.86
XChaCha20_XORKeyStream1K-4  507MB/s ± 0%       4.70

chacha20's People

Contributors

jedisct1 avatar lukechampine avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.