{"id":15032872,"url":"https://github.com/ruby/securerandom","last_synced_at":"2025-05-15T09:08:29.871Z","repository":{"id":42977438,"uuid":"266091348","full_name":"ruby/securerandom","owner":"ruby","description":"Interface for secure random number generator","archived":false,"fork":false,"pushed_at":"2025-04-29T23:50:38.000Z","size":146,"stargazers_count":55,"open_issues_count":4,"forks_count":17,"subscribers_count":31,"default_branch":"master","last_synced_at":"2025-04-30T00:29:58.097Z","etag":null,"topics":["ruby"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","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":"COPYING","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,"zenodo":null}},"created_at":"2020-05-22T11:13:51.000Z","updated_at":"2025-04-29T23:50:40.000Z","dependencies_parsed_at":"2023-12-12T07:30:45.895Z","dependency_job_id":"882f9bd8-e40a-43dc-b760-adf1829324bf","html_url":"https://github.com/ruby/securerandom","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruby%2Fsecurerandom","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruby%2Fsecurerandom/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruby%2Fsecurerandom/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruby%2Fsecurerandom/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ruby","download_url":"https://codeload.github.com/ruby/securerandom/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254310520,"owners_count":22049470,"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:38.596Z","updated_at":"2025-05-15T09:08:24.863Z","avatar_url":"https://github.com/ruby.png","language":"Ruby","readme":"# Securerandom\n\nThis library is an interface to secure random number generators which are\nsuitable for generating session keys in HTTP cookies, etc.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'securerandom'\n```\n\nAnd then execute:\n\n    $ bundle install\n\nOr install it yourself as:\n\n    $ gem install securerandom\n\n## Usage\n\nGenerate random hexadecimal strings:\n\n```ruby\nrequire 'securerandom'\n\nSecureRandom.hex(10) #=\u003e \"52750b30ffbc7de3b362\"\nSecureRandom.hex(10) #=\u003e \"92b15d6c8dc4beb5f559\"\nSecureRandom.hex(13) #=\u003e \"39b290146bea6ce975c37cfc23\"\n```\n\nGenerate random base64 strings:\n\n```ruby\nSecureRandom.base64(10) #=\u003e \"EcmTPZwWRAozdA==\"\nSecureRandom.base64(10) #=\u003e \"KO1nIU+p9DKxGg==\"\nSecureRandom.base64(12) #=\u003e \"7kJSM/MzBJI+75j8\"\n```\n\nGenerate random binary strings:\n\n```ruby\nSecureRandom.random_bytes(10) #=\u003e \"\\016\\t{\\370g\\310pbr\\301\"\nSecureRandom.random_bytes(10) #=\u003e \"\\323U\\030TO\\234\\357\\020\\a\\337\"\n```\n\nGenerate alphanumeric strings:\n\n```ruby\nSecureRandom.alphanumeric(10) #=\u003e \"S8baxMJnPl\"\nSecureRandom.alphanumeric(10) #=\u003e \"aOxAg8BAJe\"\n```\n\nGenerate UUIDs:\n\n```ruby\nSecureRandom.uuid #=\u003e \"2d931510-d99f-494a-8c67-87feb05e1594\"\nSecureRandom.uuid #=\u003e \"bad85eb9-0713-4da7-8d36-07a8e4b00eab\"\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/securerandom.\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fruby%2Fsecurerandom","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fruby%2Fsecurerandom","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fruby%2Fsecurerandom/lists"}