Implementation of https://eprint.iacr.org/2013/129