)]}'
{
  "commit": "eadef4730e66f914d7b9cbb2f38ecf7989f992ed",
  "tree": "9306bf94ffe191b2a3849e48f86e59b4a6b0b3a0",
  "parents": [
    "20f4a043eb8c148d044777b849a1cc1e0168b9ee"
  ],
  "author": {
    "name": "Adam Langley",
    "email": "alangley@gmail.com",
    "time": "Wed Jan 16 17:20:24 2019 -0800"
  },
  "committer": {
    "name": "Adam Langley",
    "email": "alangley@gmail.com",
    "time": "Mon Jan 21 21:32:35 2019 +0000"
  },
  "message": "Simplify HRSS mod3 circuits.\n\nThe multiplication and subtraction circuits were found by djb using GNU\nSuperoptimizer, and the addition circuit is derived from the subtraction\none by hand. They depend on a different representation: -1 is now (1, 1)\nrather than (1, 0), and the latter becomes undefined.\n\nThe following Python program checks that the circuits work:\n\nvalues \u003d [0, 1, -1]\n\ndef toBits(v):\n    if v \u003d\u003d 0:\n        return 0, 0\n    elif v \u003d\u003d 1:\n        return 0, 1\n    elif v \u003d\u003d -1:\n        return 1, 1\n    else:\n        raise ValueError(v)\n\ndef mul((s1, a1), (s2, a2)):\n    return ((s1 ^ s2) \u0026 a1 \u0026 a2, a1 \u0026 a2)\n\ndef add((s1, a1), (s2, a2)):\n    t \u003d s1 ^ a2\n    return (t \u0026 (s2 ^ a1), (a1 ^ a2) | (t ^ s2))\n\ndef sub((s1, a1), (s2, a2)):\n    t \u003d a1 ^ a2\n    return ((s1 ^ a2) \u0026 (t ^ s2), t | (s1 ^ s2))\n\ndef fromBits((s, a)):\n    if s \u003d\u003d 0 and a \u003d\u003d 0:\n        return 0\n    if s \u003d\u003d 0 and a \u003d\u003d 1:\n        return 1\n    if s \u003d\u003d 1 and a \u003d\u003d 1:\n        return -1\n    else:\n        raise ValueError((s, a))\n\ndef wrap(v):\n    if v \u003d\u003d 2:\n        return -1\n    elif v \u003d\u003d -2:\n        return 1\n    else:\n        return v\n\nfor v1 in values:\n    for v2 in values:\n        print v1, v2\n\n        result \u003d fromBits(mul(toBits(v1), toBits(v2)))\n        if result !\u003d v1 * v2:\n            raise ValueError((v1, v2, result))\n\n        result \u003d fromBits(add(toBits(v1), toBits(v2)))\n        if result !\u003d wrap(v1 + v2):\n            raise ValueError((v1, v2, result))\n\n        result \u003d fromBits(sub(toBits(v1), toBits(v2)))\n        if result !\u003d wrap(v1 - v2):\n            raise ValueError((v1, v2, result))\n\nChange-Id: Ie1a4ca5a82c2651057efc62330eca6fdd9878122\nReviewed-on: https://boringssl-review.googlesource.com/c/34344\nReviewed-by: David Benjamin \u003cdavidben@google.com\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "71fa5e30d1897bac5c24b6ead72b5547e785a4c7",
      "old_mode": 33188,
      "old_path": "crypto/hrss/hrss.c",
      "new_id": "753d50d8b03091d287c55dd5da3d0d06669d0250",
      "new_mode": 33188,
      "new_path": "crypto/hrss/hrss.c"
    },
    {
      "type": "modify",
      "old_id": "596db07c25cc6b2a0aa183baefa40516b0f97f93",
      "old_mode": 33188,
      "old_path": "crypto/hrss/hrss_test.cc",
      "new_id": "97c1bf0228d44b43230a6aa4b0c0db4ab328a38b",
      "new_mode": 33188,
      "new_path": "crypto/hrss/hrss_test.cc"
    }
  ]
}
