This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 0xcece3427ec9b685d6bc77e46219600a0b8226551 |