{"id":15583852,"url":"https://github.com/mgomes/blake2b","last_synced_at":"2025-04-24T03:46:42.785Z","repository":{"id":56842948,"uuid":"135373663","full_name":"mgomes/blake2b","owner":"mgomes","description":"A cryptographic hash function faster than MD5, SHA-1, SHA-2, and SHA-3","archived":false,"fork":false,"pushed_at":"2022-02-14T10:18:07.000Z","size":100,"stargazers_count":13,"open_issues_count":2,"forks_count":3,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-04-24T03:46:35.421Z","etag":null,"topics":["blake","blake2","blake2b","cryptographic-hash","cryptographic-hash-functions","hash-functions","ruby"],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mgomes.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-05-30T01:52:58.000Z","updated_at":"2024-03-13T23:11:06.000Z","dependencies_parsed_at":"2022-08-29T10:00:16.906Z","dependency_job_id":null,"html_url":"https://github.com/mgomes/blake2b","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mgomes%2Fblake2b","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mgomes%2Fblake2b/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mgomes%2Fblake2b/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mgomes%2Fblake2b/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mgomes","download_url":"https://codeload.github.com/mgomes/blake2b/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250560003,"owners_count":21450168,"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":["blake","blake2","blake2b","cryptographic-hash","cryptographic-hash-functions","hash-functions","ruby"],"created_at":"2024-10-02T20:21:30.448Z","updated_at":"2025-04-24T03:46:42.765Z","avatar_url":"https://github.com/mgomes.png","language":"Ruby","readme":"# BLAKE2b for Ruby\n\nBLAKE2 is a cryptographic hash function faster than MD5, SHA-1, SHA-2, and SHA-3, yet is at least as secure as the latest standard SHA-3. BLAKE2 has been adopted by many projects due to its high speed, security, and simplicity.\n\nMore info at: [https://blake2.net](https://blake2.net).\n\n## Summary\n\nThis gem is a C-extension to enable using BLAKE2b in Ruby. This BLAKE2b implementation (or just BLAKE2) is optimized for 64-bit platforms with SSE support (excluding NEON-enabled ARMs). It produces digests of any size between 1 and 64 bytes.\n\nThe C code for this gem is taken from the [official reference C implementation](https://github.com/BLAKE2/BLAKE2) as of commit [ca4c89314abff54e3806b44e4a08164f8204f09a](https://github.com/BLAKE2/BLAKE2/tree/ca4c89314abff54e3806b44e4a08164f8204f09a).\n\n## Install\n\n```\ngem install blake2b\n```\n\n## Usage\n\n``` ruby\nrequire 'blake2b'\n\n# The UTF-8 String (Required) that you want to digest.\ninput   = 'abc'\n\n# The main application of keyed BLAKE2 is as a message authentication code (MAC)\n# By default `Blake2b::Key.none` is used.\nkey = Blake2b::Key.none\n# key = Blake2b::Key.from_string(\"foo bar baz\")\n# key = Blake2b::Key.from_hex('DEADBEAF')\n# key = Blake2b::Key.from_bytes([222, 173, 190, 175])\n\n# The output length in Bytes of the Hash, Max and Default is 32.\nout_len = 32\n\n# HEX OUTPUT\n############\n\nBlake2b.hex(input)\n=\u003e \"508c5e8c327c14e2e1a72ba34eeb452f37458b209ed63a294d999b4c86675982\"\n\nBlake2b.hex(input, key)\n=\u003e \"508c5e8c327c14e2e1a72ba34eeb452f37458b209ed63a294d999b4c86675982\"\n\nBlake2b.hex(input, key, out_len)\n=\u003e \"508c5e8c327c14e2e1a72ba34eeb452f37458b209ed63a294d999b4c86675982\"\n\n# BYTES OUTPUT\n##############\n\nBlake2b.bytes(input)\n=\u003e [80, 140, 94, ...]\n\nBlake2b.bytes(input, key)\n=\u003e [80, 140, 94, ...]\n\nBlake2b.bytes(input, key, out_len)\n=\u003e [80, 140, 94, ...]\n\n```\n\n## Performance\n\n`Blake2b` really shines on larger inputs. Here are some benchmarks on various input sizes. You can find the performance suite used for these benchmarks at `performance/performance_suite.rb`. All tests were run on an iMac 27\" Late 2014, 4GHz Core i7 CPU (4790K) w/ SSE4.1 + SSE4.2, 32GB DDR3 RAM.\n\n### 1KB (1M digests)\n\n```\nMD5 result: 2.694545999998809 seconds.\nSHA2 result: 4.037195000011707 seconds.\nSHA512 result: 3.213850000000093 seconds.\nBLAKE2s result: 5.6867979999951785 seconds.\nBLAKE2b result: 4.375018999999156 seconds.\n```\n\n### 50KB (500k digests)\n\n```\nMD5 result: 34.33997299999464 seconds.\nSHA2 result: 50.161426999999094 seconds.\nSHA512 result: 35.24845699999423 seconds.\nBLAKE2s result: 64.8592859999917 seconds.\nBLAKE2b result: 30.783814999987953 seconds.\n```\n\n### 250KB (500k digests)\n\n```\nMD5 result: 67.89016799999808 seconds.\nSHA2 result: 103.09026799999992 seconds.\nSHA512 result: 72.46762200001103 seconds.\nBLAKE2s result: 133.5229810000019 seconds.\nBLAKE2b result: 64.30263599999307 seconds.\n```\n\n## Development\n\nAfter checking out the repo, run `bundle` to install dependencies. Then,\nrun `rake full` to build and test, or `rake test` to only run the tests.\n\nTo install this gem onto your local machine, run `bundle exec rake install`.\n\n## Future\n\nHopefully this gem will not be required once Ruby [issue #12802](https://bugs.ruby-lang.org/issues/12802) is resolved. Blake2 will either be included natively into MRI or available through the OpenSSL library.\n\n## License\n\nBlake2b is based heavily on [Blake2](https://github.com/franckverrot/blake2) by Franck Verrot, Copyright 2014.\n\nBlake2b is copyright 2018, Mauricio Gomes.\n\nThe original work (Blake2) and the modified work (Blake2b) are licensed GPL v3.0. See LICENSE.txt for details.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmgomes%2Fblake2b","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmgomes%2Fblake2b","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmgomes%2Fblake2b/lists"}