Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gregors/rickshaw
easy way to get SHA1 hashes
https://github.com/gregors/rickshaw
Last synced: 2 months ago
JSON representation
easy way to get SHA1 hashes
- Host: GitHub
- URL: https://github.com/gregors/rickshaw
- Owner: gregors
- License: mit
- Created: 2013-11-04T15:19:11.000Z (about 11 years ago)
- Default Branch: main
- Last Pushed: 2021-01-22T21:12:55.000Z (almost 4 years ago)
- Last Synced: 2024-10-13T22:05:41.069Z (3 months ago)
- Language: Ruby
- Size: 13.7 KB
- Stars: 9
- Watchers: 0
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Rickshaw
Easy way to get a SHA1 hash
yes I'm this lazy.
## Installation
Add this line to your application's Gemfile:
gem 'rickshaw'
And then execute:
$ bundle
Or install it yourself as:
$ gem install rickshaw
## Usage
> Rickshaw::SHA1.hash('LICENSE.txt')
=> "4659d94e7082a65ca39e7b6725094f08a413250a"> "hello world".to_sha1
=> "2aae6c35c94fcfb415dbe95f408b9ce91ee846ed"> Rickshaw::SHA256.hash("LICENSE.txt")
=> "34c15a6c0d68a79f320f7c0d11ab50f2cb9b0cb9f8bd791ce06340f7448df289"> "hello world".to_sha256
=> "b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9"> "hello world".to_md5
=> "5eb63bbbe01eeed093cb22bb8f5acdc3"We can also pack/unpack our hashes to/from binary strings
> "hello world".to_sha1.packed_bytes
=> "*\xAEl5\xC9O\xCF\xB4\x15\xDB\xE9_@\x8B\x9C\xE9\x1E\xE8F\xED"> "*\xAEl5\xC9O\xCF\xB4\x15\xDB\xE9_@\x8B\x9C\xE9\x1E\xE8F\xED".unpacked_bytes
=> "2aae6c35c94fcfb415dbe95f408b9ce91ee846ed"We can also pack/unpack to base64
> "hello world".to_base64
=> "aGVsbG8gd29ybGQ="> "aGVsbG8gd29ybGQ=".unpack_base64
=> "hello world"## Contributing
1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request