{"id":17771423,"url":"https://github.com/rootslab/asino","last_synced_at":"2025-04-01T15:18:28.583Z","repository":{"id":57184800,"uuid":"110761518","full_name":"rootslab/asino","owner":"rootslab","description":"Asino  a stubborn, simple and fast Bloom filter for the rest of us.","archived":false,"fork":false,"pushed_at":"2018-01-09T20:11:00.000Z","size":37,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-09T03:34:28.894Z","etag":null,"topics":["bloom-filter","hashing","nodejs-modules","pseudo-random","universal-hashing"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rootslab.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-11-15T00:20:42.000Z","updated_at":"2017-11-19T22:40:32.000Z","dependencies_parsed_at":"2022-09-14T08:50:39.240Z","dependency_job_id":null,"html_url":"https://github.com/rootslab/asino","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rootslab%2Fasino","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rootslab%2Fasino/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rootslab%2Fasino/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rootslab%2Fasino/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rootslab","download_url":"https://codeload.github.com/rootslab/asino/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246660075,"owners_count":20813338,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bloom-filter","hashing","nodejs-modules","pseudo-random","universal-hashing"],"created_at":"2024-10-26T21:32:50.068Z","updated_at":"2025-04-01T15:18:28.554Z","avatar_url":"https://github.com/rootslab.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"### Asino\n\n[![NPM VERSION](http://img.shields.io/npm/v/asino.svg?style=flat)](https://www.npmjs.org/package/asino)\n[![CODACY BADGE](https://img.shields.io/codacy/b18ed7d95b0a4707a0ff7b88b30d3def.svg?style=flat)](https://www.codacy.com/public/44gatti/asino)\n[![CODECLIMATE-TEST-COVERAGE](https://img.shields.io/codeclimate/c/rootslab/asino.svg?style=flat)](https://codeclimate.com/github/rootslab/asino)\n[![LICENSE](http://img.shields.io/badge/license-MIT-blue.svg?style=flat)](https://github.com/rootslab/asino#mit-license)\n\n![NODE VERSION](https://img.shields.io/node/v/asino.svg)\n[![TRAVIS CI BUILD](http://img.shields.io/travis/rootslab/asino.svg?style=flat)](http://travis-ci.org/rootslab/asino)\n[![BUILD STATUS](http://img.shields.io/david/rootslab/asino.svg?style=flat)](https://david-dm.org/rootslab/asino)\n[![DEVDEPENDENCY STATUS](http://img.shields.io/david/dev/rootslab/asino.svg?style=flat)](https://david-dm.org/rootslab/asino#info=devDependencies)\n\n[![NPM MONTHLY](http://img.shields.io/npm/dm/asino.svg?style=flat)](http://npm-stat.com/charts.html?package=asino)\n![NPM YEARLY](https://img.shields.io/npm/dy/asino.svg)\n[![NPM TOTAL](https://img.shields.io/npm/dt/asino.svg)](http://npm-stat.com/charts.html?package=asino)\n\n[![NPM GRAPH](https://nodei.co/npm/asino.png?downloads=true\u0026downloadRank=true\u0026stars=true)](https://nodei.co/npm/asino/)\n\n\n\u003e __Asino__, a stubborn, simple and fast __Bloom filter__ for the rest of us.\n\n\n### Install\n\n```bash\n$ npm install asino [-g]\n```\n\n\u003e __require__:\n\n```javascript\nvar Asino  = require( 'asino' );\n```\n### Run Tests\n\n\u003e __to run all test files, install devDependencies:__\n\n```bash\n $ cd asino/\n # install or update devDependencies\n $ npm install \n # run tests\n $ npm test\n```\n\n### Constructor\n\n```javascript\nAsino( [ Object opt ] )\n// or\nnew Asino( [ Object opt ] )\n```\n\n### Options\n\n\u003e Default options are listed.\n\n```javascript\nopt = {\n\t/*\n\t * expected population of elements\n\t */\n\tepop : 10000\n\t\n\t/*\n\t * The max number of bytes to parse from every \n\t * input element, using the pseudo-random table.\n\t * In normal mode you should specify this property\n\t * generally sizing it on the expected input length.\n\t *\n\t * When dunce mode is on, this property is ignored,\n\t * because no pseduo-random table will be generated.\n\t */\n\t, ilen : 32\n\t\n\t/*\n\t * The number of hash functions to use.\n\t * The greater the number, lesser is the probability\n\t * of collisions.\n\t *\n\t * - the false positive probability:\n\t *\n\t *   fpp ~= - 1 / ( 10 ^ hfn )\n\t *\n \t * In dunce mode this number is limited to 16.\n\t */ \n\t, hfn : 6\n\t\n\t/*\n\t * Dunce mode, it is off for default.\n\t *\n\t * It is a fast way for testing collisions/duplicates on \n\t * long inputs ( \u003e ~ 64 bytes ), without the construction\n\t * and the use of pseudo-random table, because it uses a\n\t * crypto digest to simulate 16 different hash functions.\n\t *\n\t * However, no randomness is involved for producing values,\n\t * then, for every distinct function (0-15): \n\t *\n\t * Same input -\u003e Same hash result. Every time.\n\t *\n\t * In dunce mode the integer produced by hash functions\n\t * are limited to the range [2^24, 2^32 -1].\n\t */\n\t, dunce: false\n}\n```\n\n###  Properties\n\n```javascript\n/*\n * the internal bitmap.\n */\nAsino.vector\n\n/*\n * the internal pseudo-random table used to generate k\n * indipendent hash functions.\n */\nAsino.hash\n\n/*\n * the total number of bits used for the bitmap vector.\n */\nAsino.bits\n\n/*\n * the total number of hash functions\n */\nAsino.hfn\n\n/*\n * the max bytes to parse from input\n */\nAsino.ilen\n\n/*\n * the current false positive probability\n */\nAsino.fpp\n\n```\n\n### Methods\n\n\u003e Arguments between [] are optional.\n\n```javascript\n/*\n * Check if an element exists.\n * When it returns false, we are sure that the element\n * does not exist in the filter. \n * When it returns true, there is a probability of a\n * false positive, equal to the current fpp.\n */\nAsino#key( Buffer data ) : Boolean\n\n/*\n * try to add the element if it doesn't exist.\n * It returns the same result of Asino#key\n */\nAsino#try( Buffer data ) : Boolean\n\n/*\n * Reset/regenerate the filter\n */\nAsino#yoke() : Asino\n\n/*\n * Re-build Bloom filter, via a config object.\n */\nAsino#grow( [ Object opt ] ) : Asino\n\nopt : { [ hfn: Number ] [, epop: Number] [, ilen : Number] [, dunce: Boolean] }\n\n\n```\n\n\u003e See __[examples](example/)__.\n\n### MIT License\n\n\u003e Copyright (c) 2017-present \u0026lt; Guglielmo Ferri : 44gatti@gmail.com \u0026gt;\n\n\u003e Permission is hereby granted, free of charge, to any person obtaining\n\u003e a copy of this software and associated documentation files (the\n\u003e 'Software'), to deal in the Software without restriction, including\n\u003e without limitation the rights to use, copy, modify, merge, publish,\n\u003e distribute, sublicense, and/or sell copies of the Software, and to\n\u003e permit persons to whom the Software is furnished to do so, subject to\n\u003e the following conditions:\n\n\u003e __The above copyright notice and this permission notice shall be\n\u003e included in all copies or substantial portions of the Software.__\n\n\u003e THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\n\u003e EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n\u003e MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\n\u003e IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\n\u003e CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\n\u003e TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n\u003e SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frootslab%2Fasino","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frootslab%2Fasino","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frootslab%2Fasino/lists"}