git.sr.ht/~pingoo/stdx@v0.0.0-20240218134121-094174641f6e/crypto/chacha/README.md (about)

     1  [![Godoc Reference](https://godoc.org/github.com/aead/chacha20?status.svg)](https://godoc.org/github.com/aead/chacha20)
     2  [![Build Status](https://travis-ci.org/aead/chacha20.svg?branch=master)](https://travis-ci.org/aead/chacha20)
     3  [![Go Report Card](https://goreportcard.com/badge/aead/chacha20)](https://goreportcard.com/report/aead/chacha20)
     4  
     5  ## The ChaCha20 stream cipher
     6  
     7  ChaCha is a stream cipher family created by Daniel J. Bernstein.  
     8  The most common ChaCha variant is ChaCha20 (20 rounds). ChaCha20 is
     9  standardized in [RFC 7539](https://tools.ietf.org/html/rfc7539 "RFC 7539").
    10  
    11  This package provides implementations of three ChaCha versions:
    12  - ChaCha20 with a 64 bit nonce (can en/decrypt up to 2^64 * 64 bytes for one key-nonce combination)  
    13  - ChaCha20 with a 96 bit nonce (can en/decrypt up to 2^32 * 64 bytes ~ 256 GB for one key-nonce combination)  
    14  - XChaCha20 with a 192 bit nonce (can en/decrypt up to 2^64 * 64 bytes for one key-nonce combination)  
    15  
    16  Furthermore the chacha sub package implements ChaCha20/12 and ChaCha20/8.
    17  These versions use 12 or 8 rounds instead of 20.
    18  But it's recommended to use ChaCha20 (with 20 rounds) - it will be fast enough for almost all purposes. 
    19  
    20  ### Installation 
    21  Install in your GOPATH: `go get -u github.com/aead/chacha20`
    22  
    23  ### Requirements
    24  All go versions >= 1.8.7 are supported.
    25  The code may also work on Go 1.7 but this is not tested.
    26  
    27  ### Performance
    28  
    29  #### AMD64
    30  Hardware: Intel i7-6500U 2.50GHz x 2  
    31  System: Linux Ubuntu 16.04 - kernel: 4.4.0-62-generic  
    32  Go version: 1.8.0  
    33  ```
    34  AVX2
    35  name                        speed              cpb
    36  ChaCha20_64-4                573MB/s ± 0%      4.16
    37  ChaCha20_1K-4               2.19GB/s ± 0%      1.06
    38  XChaCha20_64-4               261MB/s ± 0%      9.13
    39  XChaCha20_1K-4              1.69GB/s ± 4%      1.37
    40  XORKeyStream64-4             474MB/s ± 2%      5.02
    41  XORKeyStream1K-4            2.09GB/s ± 1%      1.11
    42  XChaCha20_XORKeyStream64-4   262MB/s ± 0%      9.09
    43  XChaCha20_XORKeyStream1K-4  1.71GB/s ± 1%      1.36
    44  
    45  SSSE3
    46  name                        speed              cpb
    47  ChaCha20_64-4                583MB/s ± 0%      4.08
    48  ChaCha20_1K-4               1.15GB/s ± 1%      2.02
    49  XChaCha20_64-4               267MB/s ± 0%      8.92
    50  XChaCha20_1K-4               984MB/s ± 5%      2.42
    51  XORKeyStream64-4             492MB/s ± 1%      4.84
    52  XORKeyStream1K-4            1.10GB/s ± 5%      2.11
    53  XChaCha20_XORKeyStream64-4   266MB/s ± 0%      8.96
    54  XChaCha20_XORKeyStream1K-4  1.00GB/s ± 2%      2.32
    55  ```
    56  #### 386
    57  Hardware: Intel i7-6500U 2.50GHz x 2  
    58  System: Linux Ubuntu 16.04 - kernel: 4.4.0-62-generic  
    59  Go version: 1.8.0  
    60  ```
    61  SSSE3
    62  name                        speed              cpb
    63  ChaCha20_64-4               570MB/s ± 0%       4.18
    64  ChaCha20_1K-4               650MB/s ± 0%       3.66
    65  XChaCha20_64-4              223MB/s ± 0%      10.69
    66  XChaCha20_1K-4              584MB/s ± 1%       4.08
    67  XORKeyStream64-4            392MB/s ± 1%       6.08
    68  XORKeyStream1K-4            629MB/s ± 1%       3.79
    69  XChaCha20_XORKeyStream64-4  222MB/s ± 0%      10.73
    70  XChaCha20_XORKeyStream1K-4  585MB/s ± 0%       4.07
    71  
    72  SSE2
    73  name                        speed              cpb
    74  ChaCha20_64-4               509MB/s ± 0%       4.68
    75  ChaCha20_1K-4               553MB/s ± 2%       4.31
    76  XChaCha20_64-4              201MB/s ± 0%      11.86
    77  XChaCha20_1K-4              498MB/s ± 4%       4.78
    78  XORKeyStream64-4            359MB/s ± 1%       6.64
    79  XORKeyStream1K-4            545MB/s ± 0%       4.37
    80  XChaCha20_XORKeyStream64-4  201MB/s ± 1%      11.86
    81  XChaCha20_XORKeyStream1K-4  507MB/s ± 0%       4.70
    82  ```