{"id":25135563,"url":"https://github.com/sharshenov/bithex","last_synced_at":"2025-04-24T01:27:15.506Z","repository":{"id":55485896,"uuid":"162688493","full_name":"sharshenov/bithex","owner":"sharshenov","description":"[bɪtheks] Store hex strings as bit strings in PostgreSQL. ","archived":false,"fork":false,"pushed_at":"2023-03-24T20:16:10.000Z","size":8,"stargazers_count":5,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-09T17:04:08.796Z","etag":null,"topics":["bitstring","hex","postgresql","rails"],"latest_commit_sha":null,"homepage":"","language":"Ruby","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/sharshenov.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-12-21T08:34:53.000Z","updated_at":"2019-01-10T13:56:01.000Z","dependencies_parsed_at":"2024-11-15T04:49:05.979Z","dependency_job_id":"88c32bec-bc53-4f5c-878e-868da8921c00","html_url":"https://github.com/sharshenov/bithex","commit_stats":{"total_commits":3,"total_committers":1,"mean_commits":3.0,"dds":0.0,"last_synced_commit":"e10c36ec13ca9097535d852b00e71fcb0827c76f"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sharshenov%2Fbithex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sharshenov%2Fbithex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sharshenov%2Fbithex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sharshenov%2Fbithex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sharshenov","download_url":"https://codeload.github.com/sharshenov/bithex/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250543039,"owners_count":21447825,"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":["bitstring","hex","postgresql","rails"],"created_at":"2025-02-08T16:33:50.121Z","updated_at":"2025-04-24T01:27:15.467Z","avatar_url":"https://github.com/sharshenov.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Bithex [![Build Status](https://travis-ci.org/sharshenov/bithex.svg?branch=master)](https://travis-ci.org/sharshenov/bithex) [![Gem Version](https://badge.fury.io/rb/bithex.svg)](https://badge.fury.io/rb/bithex)\n\nStore hex strings as [PostgreSQL bit strings](https://edgeguides.rubyonrails.org/active_record_postgresql.html#bit-string-types) to reduce column size 2x.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'bithex'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install bithex\n\n## Usage\n\nCreate column\n\n```\ncreate_table :uploads do |t|\n  t.column :digest, \"bit(160)\" # For SHA1 limit is 160, for MD5 limit is 128\nend\n```\n\nDefine bithex attributes\n\n```ruby\nclass Upload \u003c ActiveRecord::Base\n  bithex :digest\n\n  # if you have multiple attributes to store as bit string\n  # bithex :foo, :bar, :baz\nend\n```\n\nTreat you bithex attribute as usual string, but remember: string length is hardcoded by limit of bit column (40 for SHA1, 32 for MD5)\n\n```ruby\nupload = Upload.new\nupload.digest = Digest::SHA1.hexdigest('foo bar baz') # c7567e8b39e2428e38bf9c9226ac68de4c67dc39\nupload.save\n```\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/sharshenov/bithex.\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsharshenov%2Fbithex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsharshenov%2Fbithex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsharshenov%2Fbithex/lists"}