{"id":15032759,"url":"https://github.com/ruby/digest","last_synced_at":"2025-04-14T08:16:53.076Z","repository":{"id":24482280,"uuid":"98617571","full_name":"ruby/digest","owner":"ruby","description":"Provides a framework for message digest libraries.","archived":false,"fork":false,"pushed_at":"2025-04-07T08:08:51.000Z","size":596,"stargazers_count":50,"open_issues_count":10,"forks_count":30,"subscribers_count":34,"default_branch":"master","last_synced_at":"2025-04-14T08:16:48.776Z","etag":null,"topics":["ruby"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ruby.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":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-07-28T06:42:15.000Z","updated_at":"2025-04-04T04:38:57.000Z","dependencies_parsed_at":"2023-01-14T01:02:58.078Z","dependency_job_id":"3d781d0f-4c4a-4f57-ae8e-cf84820b8c3a","html_url":"https://github.com/ruby/digest","commit_stats":{"total_commits":377,"total_committers":37,"mean_commits":10.18918918918919,"dds":0.806366047745358,"last_synced_commit":"d152f5a043ea49ea7968bfebf7cd6b9318b4d557"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruby%2Fdigest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruby%2Fdigest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruby%2Fdigest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruby%2Fdigest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ruby","download_url":"https://codeload.github.com/ruby/digest/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248844000,"owners_count":21170499,"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":["ruby"],"created_at":"2024-09-24T20:19:23.360Z","updated_at":"2025-04-14T08:16:53.047Z","avatar_url":"https://github.com/ruby.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Digest\n\n![CI](https://github.com/ruby/digest/workflows/CI/badge.svg?branch=master\u0026event=push)\n\nThis module provides a framework for message digest libraries.\n\nYou may want to look at OpenSSL::Digest as it supports more algorithms.\n\nA cryptographic hash function is a procedure that takes data and returns a fixed bit string: the hash value, also known as _digest_. Hash functions are also called one-way functions, it is easy to compute a digest from a message, but it is infeasible to generate a message from a digest.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'digest'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install digest\n\n## Usage\n\n```ruby\nrequire 'digest'\n\n# Compute a complete digest\nDigest::SHA256.digest 'message'       #=\u003e \"\\xABS\\n\\x13\\xE4Y...\"\n\nsha256 = Digest::SHA256.new\nsha256.digest 'message'               #=\u003e \"\\xABS\\n\\x13\\xE4Y...\"\n\n# Other encoding formats\nDigest::SHA256.hexdigest 'message'    #=\u003e \"ab530a13e459...\"\nDigest::SHA256.base64digest 'message' #=\u003e \"q1MKE+RZFJgr...\"\n\n# Compute digest by chunks\nmd5 = Digest::MD5.new\nmd5.update 'message1'\nmd5 \u003c\u003c 'message2'                     # \u003c\u003c is an alias for update\n\nmd5.hexdigest                         #=\u003e \"94af09c09bb9...\"\n\n# Compute digest for a file\nsha256 = Digest::SHA256.file 'testfile'\nsha256.hexdigest\n```\n\nAdditionally digests can be encoded in \"bubble babble\" format as a sequence of consonants and vowels which is more recognizable and comparable than a hexadecimal digest.\n\n```ruby\nrequire 'digest/bubblebabble'\n\nDigest::SHA256.bubblebabble 'message' #=\u003e \"xopoh-fedac-fenyh-...\"\n```\n\nSee the bubble babble specification at http://web.mit.edu/kenta/www/one/bubblebabble/spec/jrtrjwzi/draft-huima-01.txt.\n\n## Digest algorithms\n\nDifferent digest algorithms (or hash functions) are available:\n\n```\nMD5::\n See RFC 1321 The MD5 Message-Digest Algorithm\nRIPEMD-160::\n  As Digest::RMD160.\n  See http://homes.esat.kuleuven.be/~bosselae/ripemd160.html.\nSHA1::\n  See FIPS 180 Secure Hash Standard.\nSHA2 family::\n  See FIPS 180 Secure Hash Standard which defines the following algorithms:\n SHA512\n SHA384\n SHA256\n```\n\nThe latest versions of the FIPS publications can be found here: http://csrc.nist.gov/publications/PubsFIPS.html.\n\n## For Gem developers\n\nIf you want to use digest algorithms in your C extension, you can use the `digest.h` header file provided by digest gem. You should add the following code to your `extconf.rb`:\n\n```ruby\nspec = Gem::Specification.find_by_name(\"digest\")\nsource_dir = File.join(spec.full_gem_path, \"ext\", \"digest\")\n$INCFLAGS += \" -I#{source_dir}\"\n```\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/ruby/digest.\n\n## License\n\nThe gem is available as open source under the terms of the [2-Clause BSD License](https://opensource.org/licenses/BSD-2-Clause).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fruby%2Fdigest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fruby%2Fdigest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fruby%2Fdigest/lists"}