Clone this repo:
  1. 6ceb25d Writing METADATA file for rappor am: 9d7cfa8217 by Sadaf Ebrahimi · 4 months ago main-16k-with-phones master
  2. 9d7cfa8 Writing METADATA file for rappor by Sadaf Ebrahimi · 5 months ago
  3. 912f8cc Merge sc-mainline-prod by Xin Li · 1 year, 8 months ago android13-dev android13-frc-adbd-release android13-frc-art-release android13-frc-cellbroadcast-release android13-frc-conscrypt-release android13-frc-documentsui-release android13-frc-extservices-release android13-frc-ipsec-release android13-frc-media-release android13-frc-media-swcodec-release android13-frc-networking-release android13-frc-neuralnetworks-release android13-frc-os-statsd-release android13-frc-permission-release android13-frc-resolv-release android13-frc-scheduling-release android13-mainline-adservices-release android13-mainline-appsearch-release android13-mainline-go-adbd-release android13-mainline-go-adservices-release android13-mainline-go-appsearch-release android13-mainline-go-art-release android13-mainline-go-cellbroadcast-release android13-mainline-go-conscrypt-release android13-mainline-go-documentsui-release android13-mainline-go-extservices-release android13-mainline-go-ipsec-release android13-mainline-go-media-release android13-mainline-go-media-swcodec-release android13-mainline-go-mediaprovider-release android13-mainline-go-networking-release android13-mainline-go-neuralnetworks-release android13-mainline-go-odp-release android13-mainline-go-os-statsd-release android13-mainline-go-permission-release android13-mainline-go-resolv-release android13-mainline-go-scheduling-release android13-mainline-go-sdkext-release android13-mainline-go-tethering-release android13-mainline-go-tzdata4-release android13-mainline-go-uwb-release android13-mainline-go-wifi-release android13-mainline-tzdata4-release android13-mainline-uwb-release android13-qpr1-release android13-qpr1-s1-release android13-qpr1-s2-release android13-qpr1-s3-release android13-qpr1-s4-release android13-qpr1-s5-release aml_ads_331131000 aml_ase_331011020 aml_ase_331112000 aml_go_adb_330913000 aml_go_ads_330913000 aml_go_art_330913000 aml_go_ase_330913000 aml_go_cbr_330912000 aml_go_con_330913000 aml_go_doc_330912000 aml_go_ext_330912000 aml_go_ips_330911000 aml_go_med_330913000 aml_go_mpr_330912000 aml_go_net_330913000 aml_go_neu_330912000 aml_go_odp_330912000 aml_go_per_330912000 aml_go_res_330912000 aml_go_sch_330911000 aml_go_sdk_330810000 aml_go_sta_330911000 aml_go_swc_330913000 aml_go_tet_330914010 aml_go_tz4_330912000 aml_go_uwb_330912000 aml_go_wif_330911000 aml_tz4_331012000 aml_tz4_331012040 aml_tz4_331012050 aml_tz4_331314010 aml_uwb_330810010 aml_uwb_331015040 aml_uwb_331115000 aml_uwb_331310030 android-13.0.0_r16 android-13.0.0_r17 android-13.0.0_r18 android-13.0.0_r19 android-13.0.0_r20 android-13.0.0_r21 android-13.0.0_r22 android-13.0.0_r23 android-13.0.0_r24 t_frc_adb_330444000 t_frc_art_330443060 t_frc_ase_330444010 t_frc_cbr_330443000 t_frc_con_330443020 t_frc_doc_330443000 t_frc_doc_330443060 t_frc_doc_330543000 t_frc_ext_330443000 t_frc_ips_330443010 t_frc_med_330443030 t_frc_net_330443000 t_frc_neu_330443000 t_frc_neu_330443030 t_frc_odp_330442000 t_frc_per_330444010 t_frc_res_330443000 t_frc_sch_330443010 t_frc_sch_330443040 t_frc_sta_330443010 t_frc_swc_330443010 t_frc_swc_330443040 t_frc_tz4_330443010
  4. d0076ef [LSC] Add LOCAL_LICENSE_KINDS to external/rappor am: 53074ed4c6 am: 980a145612 am: 496117c9f9 am: a2ae3d61cd by Bob Badour · 2 years ago android12-mainline-art-release android12-mainline-networkstack-release aml_tz3_311312010 android-mainline-12.0.0_r100 android-mainline-12.0.0_r113 android-mainline-12.0.0_r115 android-mainline-12.0.0_r122 android-mainline-12.0.0_r19 android-mainline-12.0.0_r22 android-mainline-12.0.0_r39 android-mainline-12.0.0_r42 android-mainline-12.0.0_r49 android-mainline-12.0.0_r5 android-mainline-12.0.0_r56 android-mainline-12.0.0_r59 android-mainline-12.0.0_r63 android-mainline-12.0.0_r69 android-mainline-12.0.0_r70 android-mainline-12.0.0_r77 android-mainline-12.0.0_r98 android-mainline-12.0.0_r99
  5. 3727623 [LSC] Add LOCAL_LICENSE_KINDS to external/rappor am: 53074ed4c6 am: 980a145612 am: 496117c9f9 am: a2ae3d61cd by Bob Badour · 2 years ago


RAPPOR is a novel privacy technology that allows inferring statistics about populations while preserving the privacy of individual users.

This repository contains simulation and analysis code in Python and R.

For a detailed description of the algorithms, see the paper and links below.

Feel free to send feedback to

Running the Demo

Although the Python and R libraries should be portable to any platform, our end-to-end demo has only been tested on Linux.

If you don't have a Linux box handy, you can view the generated output.

To setup your enviroment there are some packages and R dependencies. There is a setup script to install them: $ ./ Then to build the native components run: $ ./ This compiles and tests the fastrand C extension module for Python, which speeds up the simulation.

Finally to run the demo run: $ ./

The demo strings together the Python and R code. It:

  1. Generates simulated input data with different distributions
  2. Runs it through the RAPPOR privacy-preserving reporting mechanisms
  3. Analyzes and plots the aggregated reports against the true input

The output is written to _tmp/regtest/results.html, and can be opened with a browser.


R analysis (analysis/R):

Demo dependencies (

These are necessary if you want to test changes to the code.

Python client (client/python):

  • None. You should be able to just import the file.


  • R: tested on R 3.0.
  • Python: tested on Python 2.7.
  • OS: the shell script tests have been tested on Linux, but may work on Mac/Cygwin. The R and Python code should work on any OS.


To run tests:

$ ./

This currently runs Python unit tests, lints Python source files, and runs R unit tests.

API is a tiny standalone Python file, and you can easily copy it into a Python program.

NOTE: Its interface is subject to change. We are in the demo stage now, but if there's demand, we will document and publish the interface.

The R interface is also subject to change.

The fastrand C module is optional. It‘s likely only useful for simulation of thousands of clients. It doesn’t use cryptographically strong randomness, and thus should not be used in production.

Directory Structure

  R/                 # R code for analysis
  cpp/               # Fast reimplementations of certain analysis
                     #   algorithms
apps/                # Web apps to help you use RAPPOR (using Shiny)
bin/                 # Command line tools for analysis.
client/              # Client libraries
  python/            # Python client library
  cpp/               # C++ client library
doc/                 # Documentation
tests/               # Tools for regression tests
  compare_dist.R     # Test helper for single variable analysis
  gen_true_values.R  # Generate test input    # Generate an HTML report for the regtest      # RAPPOR client simulation    # Specification of test cases
  ...             # Build scripts (docs, C extension, etc.)              # Quick demonstration              # Generate docs form the markdown in doc/
gh-pages/            # Where generated docs go. (A subtree of the branch gh-pages)
pipeline/            # Analysis pipeline code.           # End-to-end regression tests, including client
                     #  libraries and analysis             # Install dependencies (for Linux)              # Test runner




  • Google Blog Post about RAPPOR
  • RAPPOR implementation in Chrome
    • This is a production quality C++ implementation, but it‘s somewhat tied to Chrome, and doesn’t support all privacy parameters (e.g. only a few values of p and q). On the other hand, the code in this repo is not yet production quality, but supports experimentation with different parameters and data sets. Of course, anyone is free to implement RAPPOR independently as well.
  • Mailing list: