Skip to content

Instantly share code, notes, and snippets.

View gavinzheng's full-sized avatar

Gavin Zheng gavinzheng

View GitHub Profile
@gavinzheng
gavinzheng / rlwe_he_scheme.py
Created August 21, 2021 10:30 — forked from youben11/rlwe_he_scheme.py
Implementation of an homomorphic encryption scheme with numpy based on the ring learning with error problem
"""A basic homomorphic encryption scheme inspired from BFV https://eprint.iacr.org/2012/144.pdf
You can read my blog post explaining the implementation details here: https://www.ayoub-benaissa.com/blog/build-he-scheme-from-scratch-python/
Disclaimer: This implementation doesn’t neither claim to be secure nor does it follow software engineering best practices,
it is designed as simple as possible for the reader to understand the concepts behind homomorphic encryption schemes.
"""
import numpy as np
from numpy.polynomial import polynomial as poly
@gavinzheng
gavinzheng / ERC20TokenContract.sol
Created March 29, 2019 05:50
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.4.24+commit.e67f0147.js&optimize=false&gist=
pragma solidity ^0.4.24;
contract ERC20TokenContract {
uint256 _totalSupply;
mapping(address => uint256) balances;
constructor(uint256 _initialSupply) public {
_totalSupply = _initialSupply;
balances[msg.sender] = _initialSupply;
}
function totalSupply() public view returns (uint256) {
return _totalSupply;
0xcece3427ec9b685d6bc77e46219600a0b8226551