Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add compact encoding (v2) #73

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Commits on Jul 8, 2020

  1. Configuration menu
    Copy the full SHA
    54d33bd View commit details
    Browse the repository at this point in the history

Commits on Jul 9, 2020

  1. add compact cookie encoding.

    Use exclusively Blake2s as a MAC and ChaCha20 as a stream cipher.
    Blake2s is always faster than SHA2 and could be safely used as a MAC
    without HMAC construction (therefore, it is much faster than HMAC-SHA256).
    ChaCha20 is a bit slower than AES-CTR, but its usage causes less
    allocations. And it is faster without AES hardware optimization
    (appengine for example).
    funny-falcon committed Jul 9, 2020
    Configuration menu
    Copy the full SHA
    406f3ed View commit details
    Browse the repository at this point in the history
  2. add tests and benchmark for compact encoding

    BenchmarkLegacyEncode-8     239144   4504 ns/op  3445 B/op   21 allocs/op
    BenchmarkLegacyEncode-8     261038   4499 ns/op  3442 B/op   21 allocs/op
    BenchmarkCompactEncode-8    933446   1304 ns/op   721 B/op    4 allocs/op
    BenchmarkCompactEncode-8    927328   1331 ns/op   721 B/op    4 allocs/op
    BenchmarkLegacyDecode-8     298273   3923 ns/op  2312 B/op   17 allocs/op
    BenchmarkLegacyDecode-8     298401   3944 ns/op  2367 B/op   17 allocs/op
    BenchmarkCompactDecode-8    806112   1359 ns/op   465 B/op    3 allocs/op
    BenchmarkCompactDecode-8    905617   1348 ns/op   471 B/op    3 allocs/op
    funny-falcon committed Jul 9, 2020
    Configuration menu
    Copy the full SHA
    d410dc2 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    f278b85 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    f83c210 View commit details
    Browse the repository at this point in the history

Commits on Jul 12, 2020

  1. less opinionated scheme

    simplify use of Blake2s and ChaCha:
    - use keyed Blake2s instance
    - use 192bit nonce with XChaCha20 (add 8 byte 'version+timestamp' header to mac)
    - get rid of cookie name length restriction (yes, allocate []byte(name))
    funny-falcon committed Jul 12, 2020
    Configuration menu
    Copy the full SHA
    b5523ec View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    0820f4f View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    cf607a7 View commit details
    Browse the repository at this point in the history