{"id":19494762,"url":"https://github.com/ceejbot/avon","last_synced_at":"2025-04-25T21:32:11.381Z","repository":{"id":16461495,"uuid":"19213525","full_name":"ceejbot/avon","owner":"ceejbot","description":"node bindings for the blake2 cryptographic hash","archived":false,"fork":false,"pushed_at":"2021-02-25T09:41:51.000Z","size":542,"stargazers_count":2,"open_issues_count":30,"forks_count":5,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-09-16T12:29:18.975Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ceejbot.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":"2014-04-27T18:47:54.000Z","updated_at":"2022-01-11T11:13:56.000Z","dependencies_parsed_at":"2022-07-10T06:16:08.193Z","dependency_job_id":null,"html_url":"https://github.com/ceejbot/avon","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ceejbot%2Favon","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ceejbot%2Favon/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ceejbot%2Favon/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ceejbot%2Favon/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ceejbot","download_url":"https://codeload.github.com/ceejbot/avon/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224018562,"owners_count":17242081,"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":[],"created_at":"2024-11-10T21:32:56.499Z","updated_at":"2024-11-10T21:33:12.901Z","avatar_url":"https://github.com/ceejbot.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# avon\n\nNode bindings for the [blake2](https://blake2.net) cryptographic hash function. The relationship of Avon to Blake is of course [obvious](https://en.wikipedia.org/wiki/Kerr_Avon).\n\nBlake2 provides four different hashing functions:\n\n* `blake2b`, `blake2bp`: 64-bit architectures, single \u0026 multicore variations\n* `blake2s`, `blake2sp`: 32-bit and under architectures, single \u0026 multicore variations\n\nAll four algorithms are different \u0026 will produce different sums. Choose the one that's appropriate for your use.\n\n[![on npm](https://img.shields.io/npm/v/avon.svg?style=flat)](https://www.npmjs.com/package/avon) [![Build Status](http://img.shields.io/travis/ceejbot/avon/master.svg?style=flat)](https://travis-ci.org/ceejbot/avon) [![Coverage Status](https://img.shields.io/coveralls/ceejbot/avon.svg?style=flat)](https://coveralls.io/github/ceejbot/avon?branch=master)\n\nTested on node 6, 8, and 10.\n\n## Usage\n\nAvon exports `sumFile()`, `sumBuffer()`, and `sumStream()` functions to calculate a hash for whatever sort of data you have. `sumBuffer()` is synchronous. `sumFile()` and `sumStream()` take an optional callback. If no callback is provided, they return promises. Use the control flow method you prefer! The calculated hash is a node Buffer.\n\nIf you don't specify an algorithm, the 64-bit single-core `B` algorithm is used.\n\n```js\nvar Avon = require('avon');\nvar assert = require('assert');\n\nvar buf = Buffer.from('this is some input');\n\nvar hash = Avon.sumBuffer(buf, Avon.ALGORITHMS.BP);\nassert(hash instanceof Buffer);\nconsole.log(hash.toString('hex'));\n\nvar sum = Avon.sumBuffer(buf, Avon.ALGORITHMS.SP);\nconsole.log(sum.toString('hex');\n```\n\nWant to hash a file? Sure!\n\n```javascript\nAvon.sumFile('my_file.dat', Avon.ALGORITHMS.SP, function(err, buffer)\n{\n\tif (err) console.error('noooo!');\n\telse console.log(buffer.toString('hex'))\n});\n```\n\nOr create a stream:\n\n```js\nvar input = fs.createReadStream('my-large-file');\nvar hasher = Avon.sumStream(Avon.ALGORITHMS.BP);\n\ninput.on('close', function()\n{\n\tvar digest = hasher.digest('hex');\n\t// you now have a string with the final hash digest\n\t// the hash is unusable from here on\n});\n\ninput.pipe(hasher);\n```\n\n## API\n\n`Avon.ALGORITHMS` exports the enum-like list of algorithms: `B`, `BP`, `S`, and `SP`.\n\nBlake2 provides a bewildering variety of variations. Avon exposes all of them both in the general-purpose functions given above, and in some convenience wrappers. This chart might help you decide which to use.\n\n| function | input | arch | multicore? | async? | algo name\n| --- | --- | --- | --- | --- | ---\n| sumStream | stream | * | * | - | pass algo name\n| sumBuffer | buffer | * | * | n | pass algo name\n| sumFile | file | * | * | y | pass algo name\n| blake2  | buffer | 64 | n | n | B\n| blake2SMP  | buffer | 64 | y | n | BP\n| blake2_32  | buffer | 32 | n | n | S\n| blake2_32SMP  | buffer | 32 | y | n | SP\n| blake2File | file | 64 | n | y | B\n| blake2SMPFile | file | 64 | y | y | BP\n| blake2_32File | file | 32 | n | y | S\n| blake2_32SMPFile | file | 32 | y | y | SP\n\n## Notes\n\nV8 bindings made considerably easier thanks to [NAN](https://github.com/nodejs/nan).\n\n## License\n\nISC.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fceejbot%2Favon","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fceejbot%2Favon","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fceejbot%2Favon/lists"}