GithubHelp home page GithubHelp logo

cbranch / pat-go Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cloudflare/pat-go

0.0 1.0 0.0 2.77 MB

Private Access Tokens reference implementation

License: BSD 3-Clause "New" or "Revised" License

Python 2.30% Go 97.37% Makefile 0.33%

pat-go's Introduction

Private Access Tokens Go Library

This repository provides a Go implementation of the basic and rate-limited Privacy Pass issuance protocols. It is meant for experimental and interop purposes, and not to be used in production. It is expected that changes in the code, repository, and API may occur in the future as the Privacy Pass standard evolves.

Test vectors

To generate test vectors, run:

$ make vectors

This will produce several JSON files:

  • anon-origin-id-test-vectors.json: Test vectors for computing the Anonymous Issuer Origin ID value in the rate-limited issuance protocol.
  • basic-issuance-test-vectors.json: Test vectors for the private basic issuance protocol (type 0x0001).
  • basic-public-issuance-test-vectors.json: Test vectors for the private basic issuance protocol (type 0x0002).
  • ed25519-blinding-test-vectors.json: Test vectors for ed25519 key blinding and signing.
  • ecdsa-blinding-test-vectors.json: Test vectors for ECDSA key blinding and signing.
  • index-test-vectors.json: Test vectors for the client-origin index computation.
  • origin-encryption-test-vectors.json: Test vectors for origin name encrpytion.

Examples for generating and verifying the test vectors can be found in the Makefile.

Performance Benchmarks

To compute performance benchmarks, run:

$ go test -bench=.

This will run benchmarks on each implemented protocol from end to end. As an example:

$ go test -bench=.
goos: darwin
goarch: amd64
pkg: github.com/cloudflare/pat-go
cpu: Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
BenchmarkPublicTokenRoundTrip/ClientRequest-12         	1000000000	         0.0001208 ns/op
BenchmarkPublicTokenRoundTrip/IssuerEvaluate-12        	1000000000	         0.001364 ns/op
BenchmarkPublicTokenRoundTrip/ClientFinalize-12        	1000000000	         0.0001122 ns/op
BenchmarkRateLimitedTokenRoundTrip/ClientRequest-12    	1000000000	         0.01773 ns/op
BenchmarkRateLimitedTokenRoundTrip/IssuerEvaluate-12   	1000000000	         0.01098 ns/op
BenchmarkRateLimitedTokenRoundTrip/AttesterProcess-12  	1000000000	         0.006127 ns/op
BenchmarkRateLimitedTokenRoundTrip/ClientFinalize-12   	1000000000	         0.0001258 ns/op
PASS
ok  	github.com/cloudflare/pat-go	0.685s

Formatting Results

To produce a LaTeX table of the performance benchmarks, run the scripts/format_benchmarks.py script on the benchmark output, like so:

$ go test -bench=. | python3 scripts/format_benchmarks.py
\begin{table}[ht!]
\label{tab:bench-computation-overhead}
\caption{Computation cost for basic and rate-limited issuance protocols
\begin{tabular}{|l|c|}
{\bf Operation} & {\bf Time (ns/op)} \hline
\hline
  Basic Client Request & $0.0001206 $ \ \hline
  Basic Issuer Evaluate & $0.001389 $ \ \hline
  Basic Client Finalize & $0.0001130 $ \ \hline
  Rate-Limited Client Request & $0.01281 $ \ \hline
  Rate-Limited Issuer Evaluate & $0.01089 $ \ \hline
  Rate-Limited Attester Process & $0.006324 $ \ \hline
  Rate-Limited Client Finalize & $0.0001205 $ \ \hline
\end{tabular}
\end{table}

pat-go's People

Contributors

armfazh avatar chris-wood 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.