├── .soliumignore ├── src └── index.js ├── migrations ├── 1_initial_migration.js └── 2_migrate_bloom_filter.js ├── scripts ├── test_module.sh ├── coverage.sh ├── test.sh ├── test_contracts.sh └── utils.sh ├── truffle-config.js ├── .soliumrc.json ├── contracts ├── Migrations.sol └── BloomFilter.sol ├── .gitignore ├── package.json ├── test ├── TestBloomFilter.sol └── BloomFilter.test.js ├── README.md ├── .travis.yml └── LICENSE /.soliumignore: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /migrations/1_initial_migration.js: -------------------------------------------------------------------------------- 1 | const Migrations = artifacts.require('./Migrations.sol') 2 | 3 | module.exports = function (deployer) { 4 | deployer.deploy(Migrations) 5 | } 6 | -------------------------------------------------------------------------------- /migrations/2_migrate_bloom_filter.js: -------------------------------------------------------------------------------- 1 | const BloomFilter = artifacts.require('./BloomFilter.sol') 2 | 3 | module.exports = function (deployer) { 4 | deployer.deploy(BloomFilter) 5 | } 6 | -------------------------------------------------------------------------------- /scripts/test_module.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | source $(dirname "$0")/utils.sh 4 | check_truffle_project 5 | trap kill_ganache SIGINT SIGTERM SIGTSTP EXIT 6 | run_ganache 8546 7 | test_module 8 | exit 0 9 | -------------------------------------------------------------------------------- /scripts/coverage.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | source $(dirname "$0")/utils.sh 3 | check_truffle_project 4 | trap kill_ganache SIGINT SIGTERM SIGTSTP 5 | run_ganache 8547 6 | run_coverage 7 | kill_ganache 8 | exit 0 9 | -------------------------------------------------------------------------------- /scripts/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | source $(dirname "$0")/utils.sh 4 | check_truffle_project 5 | trap kill_ganache SIGINT SIGTERM SIGTSTP EXIT 6 | run_ganache 8546 7 | test_contracts_and_module 8 | exit 0 9 | -------------------------------------------------------------------------------- /scripts/test_contracts.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | source $(dirname "$0")/utils.sh 4 | check_truffle_project 5 | trap kill_ganache SIGINT SIGTERM SIGTSTP EXIT 6 | run_ganache 8546 7 | test_contracts 8 | exit 0 9 | -------------------------------------------------------------------------------- /truffle-config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | networks: { 3 | development: { 4 | host: 'localhost', 5 | port: 8545, 6 | network_id: '*' // Match any network id 7 | }, 8 | test: { 9 | host: '127.0.0.1', 10 | port: 8546, 11 | network_id: 1234321 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /.soliumrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "solium:recommended", 3 | "plugins": [ 4 | "security" 5 | ], 6 | "rules": { 7 | "quotes": [ 8 | "error", 9 | "double" 10 | ], 11 | "indentation": [ 12 | "error", 13 | 4 14 | ], 15 | "linebreak-style": [ 16 | "error", 17 | "unix" 18 | ] 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /contracts/Migrations.sol: -------------------------------------------------------------------------------- 1 | pragma solidity >=0.4.21 < 0.6.0; 2 | 3 | contract Migrations { 4 | address public owner; 5 | uint public last_completed_migration; 6 | 7 | constructor() public { 8 | owner = msg.sender; 9 | } 10 | 11 | modifier restricted() { 12 | if (msg.sender == owner) _; 13 | } 14 | 15 | function setCompleted(uint completed) public restricted { 16 | last_completed_migration = completed; 17 | } 18 | 19 | function upgrade(address new_address) public restricted { 20 | Migrations upgraded = Migrations(new_address); 21 | upgraded.setCompleted(last_completed_migration); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Build artifacts of sample truffle 2 | build 3 | 4 | # IDE 5 | .idea/ 6 | 7 | # Logs 8 | logs 9 | *.log 10 | npm-debug.log* 11 | yarn-debug.log* 12 | yarn-error.log* 13 | 14 | # Runtime data 15 | pids 16 | *.pid 17 | *.seed 18 | *.pid.lock 19 | 20 | # Directory for instrumented libs generated by jscoverage/JSCover 21 | lib-cov 22 | 23 | # Coverage directory used by tools like istanbul 24 | coverage 25 | 26 | # nyc test coverage 27 | .nyc_output 28 | 29 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 30 | .grunt 31 | 32 | # Bower dependency directory (https://bower.io/) 33 | bower_components 34 | 35 | # node-waf configuration 36 | .lock-wscript 37 | 38 | # Compiled binary addons (https://nodejs.org/api/addons.html) 39 | build/Release 40 | 41 | # Dependency directories 42 | node_modules/ 43 | jspm_packages/ 44 | 45 | # TypeScript v1 declaration files 46 | typings/ 47 | 48 | # Optional npm cache directory 49 | .npm 50 | 51 | # Optional eslint cache 52 | .eslintcache 53 | 54 | # Optional REPL history 55 | .node_repl_history 56 | 57 | # Output of 'npm pack' 58 | *.tgz 59 | 60 | # Yarn Integrity file 61 | .yarn-integrity 62 | 63 | # dotenv environment variables file 64 | .env 65 | 66 | # next.js build output 67 | .next 68 | -------------------------------------------------------------------------------- /scripts/utils.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Test script should be run in the base directory 4 | check_truffle_project() { 5 | cd `dirname "$0"` && cd ../ 6 | if [ -f "truffle-config.js" ] 7 | then 8 | echo "Start testing" 9 | else 10 | echo "You should run this script in the base directory of this project" 11 | exit 1 12 | fi 13 | } 14 | 15 | # Terminate running ganaches for testing 16 | kill_ganache() { 17 | echo "Terminate ganache" 18 | if !([ -z ${pid+x} ]);then 19 | kill $pid > /dev/null 2>&1 20 | fi 21 | } 22 | 23 | # Compile contracts 24 | compile() { 25 | ./node_modules/.bin/truffle compile --all 26 | [ $? -ne 0 ] && exit 1 27 | } 28 | 29 | # Run private block-chain for test cases 30 | run_ganache() { 31 | ./node_modules/.bin/ganache-cli -i 1234321 -p $1 > /dev/null & pid=$! 32 | if ps -p $pid > /dev/null 33 | then 34 | echo "Running ganache..." 35 | else 36 | echo "Failed to run a chain" 37 | exit 1 38 | fi 39 | } 40 | 41 | 42 | 43 | # Run test cases with truffle 44 | test_contracts() { 45 | ./node_modules/.bin/truffle test test/*.sol --network test 46 | ./node_modules/.bin/truffle test test/*.js --network test 47 | [ $? -ne 0 ] && exit 1 48 | } 49 | 50 | # Check test coverage 51 | run_coverage() { 52 | ./node_modules/.bin/solidity-coverage 53 | } 54 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "solidity-bloom-filter", 3 | "version": "1.0.0", 4 | "repository": { 5 | "type": "git", 6 | "url": "git+https://github.com/wanseob/solidity-bloom-filter.git" 7 | }, 8 | "description": "This is a 256 bit based bloom filter library written in Solidity", 9 | "scripts": { 10 | "postinstall": "chmod +x scripts/*", 11 | "standard": ".\"/node_modules/.bin/standard\" test/**/*.js src/** --fix", 12 | "ethlint": ".\"/node_modules/.bin/solium\" -d contracts --fix", 13 | "precommit": "lint-staged && npm run test", 14 | "test": ".\"/scripts/test_contracts.sh\"" 15 | }, 16 | "devDependencies": { 17 | "chai": "^4.2.0", 18 | "chai-bignumber": "^3.0.0", 19 | "ganache-cli": "^6.3.0", 20 | "husky": "^1.3.1", 21 | "lint-staged": "^8.1.3", 22 | "mocha": "^5.2.0", 23 | "solium": "^1.2.2", 24 | "standard": "^12.0.1", 25 | "truffle": "^5.0.3", 26 | "typedarray-to-buffer": "^3.1.5" 27 | }, 28 | "dependencies": { 29 | "javascript-stringify": "^1.6.0", 30 | "truffle-contract": "^4.0.4" 31 | }, 32 | "standard": { 33 | "globals": [ 34 | "contract", 35 | "artifacts", 36 | "web3", 37 | "describe", 38 | "context", 39 | "before", 40 | "beforeEach", 41 | "after", 42 | "afterEach", 43 | "it", 44 | "should", 45 | "expect", 46 | "assert" 47 | ] 48 | }, 49 | "lint-staged": { 50 | "*.js": [ 51 | "./node_modules/.bin/standard --fix", 52 | "git add" 53 | ], 54 | "*.sol": [ 55 | "./node_modules/.bin/solium --fix --file", 56 | "git add" 57 | ] 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /test/TestBloomFilter.sol: -------------------------------------------------------------------------------- 1 | pragma solidity >=0.4.21 < 0.6.0; 2 | 3 | import "truffle/Assert.sol"; 4 | import "../contracts/BloomFilter.sol"; 5 | 6 | contract TestBloomFilter { 7 | using BloomFilter for BloomFilter.Filter; 8 | 9 | BloomFilter.Filter filter; 10 | 11 | function testInit() public { 12 | filter.init(10); 13 | Assert.equal(uint(filter.hashCount), uint(37), "Filter should have "); 14 | } 15 | 16 | function testAdd() public { 17 | filter.add('a'); 18 | uint256 bitmapA = filter.bitmap; 19 | filter.add('a'); 20 | uint256 bitmapB = filter.bitmap; 21 | Assert.equal(bitmapB, bitmapA, "Adding same item should not update the bitmap"); 22 | 23 | filter.add('c'); 24 | uint256 bitmapC = filter.bitmap; 25 | Assert.notEqual(bitmapC, bitmapB, "Adding different item should update the bitmap"); 26 | } 27 | 28 | function testCheck() public { 29 | string[10] memory inclusion = ['a','b','c', 'd', 'e', 'f', 'g', 'h', 'i', 'j']; 30 | string[10] memory nonInclusion = ['k','l','m', 'n', 'o', 'p', 'q', 'r', 's', 't']; 31 | for(uint i = 0; i < inclusion.length; i ++) { 32 | bytes32 key = keccak256(abi.encodePacked(inclusion[i])); 33 | filter.add(key); 34 | } 35 | for(uint j = 0; j < inclusion.length; j ++) { 36 | bytes32 key = keccak256(abi.encodePacked(inclusion[j])); 37 | bool falsePositive = filter.check(key); 38 | // It may exist or not 39 | Assert.isTrue(falsePositive, "Should return false positive"); 40 | } 41 | for(uint k = 0; k < nonInclusion.length; k ++) { 42 | bytes32 key = keccak256(abi.encodePacked(nonInclusion[k])); 43 | bool falsePositive = filter.check(key); 44 | // It definitely does not exist 45 | Assert.isFalse(falsePositive, "Should return definitely not exist"); 46 | } 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /test/BloomFilter.test.js: -------------------------------------------------------------------------------- 1 | const chai = require('chai') 2 | const BigNumber = web3.BigNumber 3 | chai.use(require('chai-bignumber')(BigNumber)).should() 4 | const BloomFilter = artifacts.require('BloomFilter') 5 | 6 | contract.only('BloomFilter', ([deployer, ...members]) => { 7 | let bloomFilter 8 | context('Test', async () => { 9 | before('Deploy library', async () => { 10 | bloomFilter = await BloomFilter.new() 11 | }) 12 | describe('getHashCount()', async () => { 13 | it('should return the hash function number using a fomula', async () => { 14 | let BIT_LEN = 256 15 | let itemNum = 32 16 | let expected = Math.ceil(BIT_LEN / (itemNum * Math.log(2))) 17 | let hashCount = await bloomFilter.getHashCount(itemNum) 18 | hashCount.toNumber().should.equal(expected) 19 | }) 20 | }) 21 | describe('addToBitmap()', async () => { 22 | let hashCount 23 | before(async () => { 24 | hashCount = await bloomFilter.getHashCount(32) 25 | }) 26 | it('should return same bitmap for the same item', async () => { 27 | let bitmapA = await bloomFilter.addToBitmap(0, hashCount, web3.utils.sha3('a')) 28 | let bitmapB = await bloomFilter.addToBitmap(bitmapA, hashCount, web3.utils.sha3('a')) 29 | bitmapA.eq(bitmapB).should.equal(true) 30 | }) 31 | it('should return different bitmap for differrent items', async () => { 32 | let bitmapA = await bloomFilter.addToBitmap(0, hashCount, web3.utils.sha3('a')) 33 | let bitmapB = await bloomFilter.addToBitmap(bitmapA, hashCount, web3.utils.sha3('b')) 34 | bitmapB.eq(bitmapA).should.equal(false) 35 | }) 36 | }) 37 | describe('falsePositive()', async () => { 38 | let inclusionSet = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'] 39 | let nonInclusionSet = ['k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't'] 40 | let hashCount 41 | let bitmap 42 | before('Add items first', async () => { 43 | hashCount = await bloomFilter.getHashCount(32) 44 | bitmap = 0 45 | for (let item of inclusionSet) { 46 | bitmap = await bloomFilter.addToBitmap(bitmap, hashCount, web3.utils.sha3(item)) 47 | } 48 | }) 49 | it('should return true for items in the inclusion set', async () => { 50 | for (let item of inclusionSet) { 51 | let falsePositive = await bloomFilter.falsePositive(bitmap, hashCount, web3.utils.sha3(item)) 52 | falsePositive.should.equal(true) 53 | } 54 | }) 55 | it('should return false for items in the non inclusion set', async () => { 56 | for (let item of nonInclusionSet) { 57 | let falsePositive = await bloomFilter.falsePositive(bitmap, hashCount, web3.utils.sha3(item)) 58 | falsePositive.should.equal(false) 59 | } 60 | }) 61 | }) 62 | }) 63 | }) 64 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Solidity Bloom Filter 2 | 3 | [![npm](https://img.shields.io/npm/v/solidity-bloom-filter/latest.svg)](https://www.npmjs.com/package/solidity-bloom-filter) 4 | [![Build Status](https://travis-ci.org/wanseob/solidity-bloom-filter.svg?branch=master)](https://travis-ci.org/wanseob/solidity-bloom-filter) 5 | 6 | Mainnet: [`0x9de80828ff54e961a41c3b31ca6e8eceadc8aef4`](https://etherscan.io/address/0x9de80828ff54e961a41c3b31ca6e8eceadc8aef4) 7 | 8 | ## Usage 9 | 10 | #### With struct 11 | 12 | ```solidity 13 | pragma solidity >=0.4.21 < 0.6.0; 14 | 15 | import "truffle/Assert.sol"; 16 | import "../contracts/BloomFilter.sol"; 17 | 18 | contract TestBloomFilter { 19 | using BloomFilter for BloomFilter.Filter; 20 | 21 | BloomFilter.Filter filter; 22 | 23 | // Initialize the filter with the expected number of items to add into the bitmap 24 | function testInit() public { 25 | filter.init(10); 26 | Assert.equal(uint(filter.hashCount), uint(37), "Filter should have "); 27 | } 28 | 29 | 30 | // It updates the bitmap of the filter with the received item. 31 | function testAdd() public { 32 | filter.add('a'); // Calling add() method will update the bitmap of the filter 33 | uint256 bitmapA = filter.bitmap; 34 | filter.add('a'); 35 | uint256 bitmapB = filter.bitmap; 36 | Assert.equal(bitmapB, bitmapA, "Adding same item should not update the bitmap"); 37 | 38 | filter.add('c'); 39 | uint256 bitmapC = filter.bitmap; 40 | Assert.notEqual(bitmapC, bitmapB, "Adding different item should update the bitmap"); 41 | } 42 | 43 | 44 | // It returns the item's false positive value. If it returns true, then 45 | // the item may exist or not. Otherwise, it definitely does not exist. 46 | function testCheck() public { 47 | string[10] memory inclusion = ['a','b','c', 'd', 'e', 'f', 'g', 'h', 'i', 'j']; 48 | string[10] memory nonInclusion = ['k','l','m', 'n', 'o', 'p', 'q', 'r', 's', 't']; 49 | for(uint i = 0; i < inclusion.length; i ++) { 50 | bytes32 key = keccak256(abi.encodePacked(inclusion[i])); 51 | filter.add(key); 52 | } 53 | for(uint j = 0; j < inclusion.length; j ++) { 54 | bytes32 key = keccak256(abi.encodePacked(inclusion[j])); 55 | bool falsePositive = filter.check(key); 56 | // It may exist or not 57 | Assert.isTrue(falsePositive, "Should return false positive"); 58 | } 59 | for(uint k = 0; k < nonInclusion.length; k ++) { 60 | bytes32 key = keccak256(abi.encodePacked(nonInclusion[k])); 61 | bool falsePositive = filter.check(key); 62 | // It definitely does not exist 63 | Assert.isFalse(falsePositive, "Should return definitely not exist"); 64 | } 65 | } 66 | 67 | } 68 | ``` 69 | 70 | ## LICENSE 71 | 72 | Apache-2.0 73 | -------------------------------------------------------------------------------- /contracts/BloomFilter.sol: -------------------------------------------------------------------------------- 1 | pragma solidity >=0.4.21 < 0.6.0; 2 | 3 | library BloomFilter { 4 | struct Filter { 5 | uint256 bitmap; 6 | uint8 hashCount; 7 | } 8 | 9 | /** 10 | * @dev It returns how many times it should be hashed, when the expected 11 | * number of input items is _itenNum. 12 | * @param _itemNum Expected number of input items 13 | */ 14 | function getHashCount(uint _itemNum) public pure returns(uint8) { 15 | uint numOfHash = (256 * 144) / (_itemNum * 100) + 1; 16 | if(numOfHash < 256) return uint8(numOfHash); 17 | else return 255; 18 | } 19 | 20 | /** 21 | * @dev It returns updated bitmap when a new item is added into the bitmap 22 | * @param _bitmap Original bitmap 23 | * @param _hashCount How many times to hash. You should use the same value with the one 24 | which is used for the original bitmap. 25 | * @param _item Hash value of an item 26 | */ 27 | function addToBitmap(uint256 _bitmap, uint8 _hashCount, bytes32 _item) public pure returns(uint256 _newBitmap) { 28 | _newBitmap = _bitmap; 29 | require(_hashCount > 0, "Hash count can not be zero"); 30 | for(uint i = 0; i < _hashCount; i++) { 31 | uint256 position = uint256(keccak256(abi.encodePacked(_item, i))) % 256; 32 | require(position < 256, "Overflow error"); 33 | uint256 digest = 1 << position; 34 | _newBitmap = _newBitmap | digest; 35 | } 36 | return _newBitmap; 37 | } 38 | 39 | /** 40 | * @dev It returns it may exist or definitely not exist. 41 | * @param _bitmap Original bitmap 42 | * @param _hashCount How many times to hash. You should use the same value with the one 43 | which is used for the original bitmap. 44 | * @param _item Hash value of an item 45 | */ 46 | function falsePositive(uint256 _bitmap, uint8 _hashCount, bytes32 _item) public pure returns(bool _probablyPresent){ 47 | require(_hashCount > 0, "Hash count can not be zero"); 48 | for(uint i = 0; i < _hashCount; i++) { 49 | uint256 position = uint256(keccak256(abi.encodePacked(_item, i))) % 256; 50 | require(position < 256, "Overflow error"); 51 | uint256 digest = 1 << position; 52 | if(_bitmap != _bitmap | digest) return false; 53 | } 54 | return true; 55 | } 56 | 57 | // Please see the test/TestBloomFilter.sol to know how to use this library in another contract. 58 | 59 | /** 60 | * @dev It initialize the Filter struct. It sets the appropriate hash count for the expected number of item 61 | * @param _itemNum Expected number of items to be added 62 | */ 63 | function init(Filter storage _filter, uint _itemNum) internal { 64 | _filter.hashCount = getHashCount(_itemNum); 65 | } 66 | 67 | /** 68 | * @dev It updates the bitmap of the filter using the given item value 69 | * @param _item Hash value of an item 70 | */ 71 | function add(Filter storage _filter, bytes32 _item) internal { 72 | _filter.bitmap = addToBitmap(_filter.bitmap, _filter.hashCount, _item); 73 | } 74 | 75 | /** 76 | * @dev It returns the filter may include the item or definitely now include it. 77 | * @param _item Hash value of an item 78 | */ 79 | function check(Filter storage _filter, bytes32 _item) internal view returns(bool) { 80 | return falsePositive(_filter.bitmap, _filter.hashCount, _item); 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - "stable" 4 | 5 | install: 6 | - npm install 7 | 8 | script: 9 | - npm run test 10 | 11 | after_success: 12 | - export CURRENT_VERSION=$(node -p "require('./package.json').version") 13 | - export LATEST=$(npm view $(node -p "require('./package.json').name") dist-tags.latest) 14 | - export NEXT=$(npm view $(node -p "require('./package.json').name") dist-tags.next) 15 | 16 | before_deploy: 17 | - if [ "$LATEST" != "$CURRENT_VERSION" ] && [ "$TRAVIS_BRANCH" = "master" ]; then 18 | echo "on master branch"; 19 | export TRAVIS_TAG=v$CURRENT_VERSION; 20 | fi; 21 | - if [ "$NEXT" != "$CURRENT_VERSION" ] && [ "$TRAVIS_BRANCH" = "develop" ]; then 22 | echo "on develop branch"; 23 | export TRAVIS_TAG=v$CURRENT_VERSION-next; 24 | fi; 25 | 26 | deploy: 27 | - provider: npm 28 | email: email@wanseob.com 29 | api_key: 30 | secure: e6XR8yhfx7MqcX0v4JcAARawdGi4oP0txWMTsxUPKxL5TkuHQLWWkEC8lEtY88U4uiNORLnMm3BlXJpejJ5DCqyo7JlMEtocOaDMcdIPPivSYWW/XXTJ8kSwT5E/bdY1nrZWmZ5ccAnOMFChOzJj3SMW42ApyaYNXSq8FMdtnXwdaaro4zLabXoUQSYscrczHZfZvkgRlLkWAByxDBChcnnhKRWfAyuOYhTXIi2r+QBbp4j3gr7qgKdQ35ENpkHm9eA/DbqXum9v7iOVkpU41ZbwvrPw/E8LbiCe1JybX18lrlt0+0Jg8dsZXFfXthCdDKuym2+JB4FK6EXvsBFMMHLsCm3mLjBxnhtmFrwr8K3cJMbtfxI1JT2g2H18QKdco58LvBYjcR8q6JDevgs9JefHRlBDA0Sr4Gr3WBE3vWT+lkqpRHK84s5Kwjv0oHVI+Oiy7hQIQSOWPVlgO8FxSFpHPsVyehjHTymeLEiMnvZRu9/bA+wz6meTT6QUVpl8Aiusqq09+ViyRL/mkWMmwWM+d1TFEDwiKDM8WEzRk0TGj2d0l0gj9zKqEBDLPF/FkrvpTQ6NdeQ6cK8JE1otlxV4tz+vHNWZNpGJn7wqKl+qWrrle1amZH0YBjwJb1IUfvJ6THJYBuybV/C+gVCssUb2dJjPSiv/K3ewn8z8l0A= 31 | tag: next 32 | on: 33 | condition: $NEXT != $CURRENT_VERSION 34 | branch: develop 35 | repo: wanseob/solidity-bloom-filter 36 | - provider: npm 37 | email: email@wanseob.com 38 | api_key: 39 | secure: e6XR8yhfx7MqcX0v4JcAARawdGi4oP0txWMTsxUPKxL5TkuHQLWWkEC8lEtY88U4uiNORLnMm3BlXJpejJ5DCqyo7JlMEtocOaDMcdIPPivSYWW/XXTJ8kSwT5E/bdY1nrZWmZ5ccAnOMFChOzJj3SMW42ApyaYNXSq8FMdtnXwdaaro4zLabXoUQSYscrczHZfZvkgRlLkWAByxDBChcnnhKRWfAyuOYhTXIi2r+QBbp4j3gr7qgKdQ35ENpkHm9eA/DbqXum9v7iOVkpU41ZbwvrPw/E8LbiCe1JybX18lrlt0+0Jg8dsZXFfXthCdDKuym2+JB4FK6EXvsBFMMHLsCm3mLjBxnhtmFrwr8K3cJMbtfxI1JT2g2H18QKdco58LvBYjcR8q6JDevgs9JefHRlBDA0Sr4Gr3WBE3vWT+lkqpRHK84s5Kwjv0oHVI+Oiy7hQIQSOWPVlgO8FxSFpHPsVyehjHTymeLEiMnvZRu9/bA+wz6meTT6QUVpl8Aiusqq09+ViyRL/mkWMmwWM+d1TFEDwiKDM8WEzRk0TGj2d0l0gj9zKqEBDLPF/FkrvpTQ6NdeQ6cK8JE1otlxV4tz+vHNWZNpGJn7wqKl+qWrrle1amZH0YBjwJb1IUfvJ6THJYBuybV/C+gVCssUb2dJjPSiv/K3ewn8z8l0A= 40 | tag: latest 41 | on: 42 | condition: $LATEST != $CURRENT_VERSION 43 | branch: master 44 | repo: wanseob/solidity-bloom-filter 45 | - provider: releases 46 | prerelease: false 47 | api_key: 48 | secure: FvzebhAmsXUKx/9Sbpa68MO64T0WwZidWVzYd8+4jl+tN5Mp8+gg/BAevO7mNr22Wx3cyEBsG/e4nwmhV5G3TWfALJrWKClOqucf1y3hmIOZ/XtUrP833yYllsINHHn6Gg1TUKzYyLbS3syvOHruVdYGME0HXowl3I+H8K3rscaBpvtLWDxjQKZmuHe12zf34KupAp7GcQjaPvgYqU+/UoOIC15CcSte/EGPi+v9mZ6b4lgGOvn29kfstzQOQ71R0EqbL3hfFyzIb99ByDiPVbToz79I9FcKQfEdLzgJDaJZzlJqRAmAvUFMLkEHKLv1i6lFlS+zphPVoB0EPPqp7HblqF4o5bLAzIavz31N5u+yKevOLoyPQxfynSUncf7Q3wLo1axw/+gAiZLiBK82+U+/M/x/8oPq58lk21U1sY3ibBYAQNln0Jw5SLVgM+O/+QNNFlUbC4C94Qigz3kqG8CeIhq59IRU9c18EJN2P3p0s4RWp3Sq9PAsslg0mCXGLd+b7V0RvWl6jFoprQiCxSJN0cKatMPJisQ73e9wHdPC+bLoCS3x70owYeveflCyPbvyfA5PiN0KEWWX4zvmrkTKh5WIxrdn34zl6BMy9TSresbDty+zmzJ4Rk2UzoakChtfIfpUVs6MbtCP7RQAuX9qqhatC6W7LzRdSNSVFpY= 49 | on: 50 | tags: true 51 | repo: wanseob/solidity-bloom-filter 52 | branch: master 53 | - provider: releases 54 | prerelease: true 55 | api_key: 56 | secure: FvzebhAmsXUKx/9Sbpa68MO64T0WwZidWVzYd8+4jl+tN5Mp8+gg/BAevO7mNr22Wx3cyEBsG/e4nwmhV5G3TWfALJrWKClOqucf1y3hmIOZ/XtUrP833yYllsINHHn6Gg1TUKzYyLbS3syvOHruVdYGME0HXowl3I+H8K3rscaBpvtLWDxjQKZmuHe12zf34KupAp7GcQjaPvgYqU+/UoOIC15CcSte/EGPi+v9mZ6b4lgGOvn29kfstzQOQ71R0EqbL3hfFyzIb99ByDiPVbToz79I9FcKQfEdLzgJDaJZzlJqRAmAvUFMLkEHKLv1i6lFlS+zphPVoB0EPPqp7HblqF4o5bLAzIavz31N5u+yKevOLoyPQxfynSUncf7Q3wLo1axw/+gAiZLiBK82+U+/M/x/8oPq58lk21U1sY3ibBYAQNln0Jw5SLVgM+O/+QNNFlUbC4C94Qigz3kqG8CeIhq59IRU9c18EJN2P3p0s4RWp3Sq9PAsslg0mCXGLd+b7V0RvWl6jFoprQiCxSJN0cKatMPJisQ73e9wHdPC+bLoCS3x70owYeveflCyPbvyfA5PiN0KEWWX4zvmrkTKh5WIxrdn34zl6BMy9TSresbDty+zmzJ4Rk2UzoakChtfIfpUVs6MbtCP7RQAuX9qqhatC6W7LzRdSNSVFpY= 57 | on: 58 | tags: true 59 | repo: wanseob/solidity-bloom-filter 60 | branch: develop 61 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | --------------------------------------------------------------------------------