binary-utils 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 126f3c74e2952fa3abf6b7c7a1a3f78b27228ff8
4
+ data.tar.gz: 35a2fb76cf6c33b2a2f0e1496edaeb74f84762b8
5
+ SHA512:
6
+ metadata.gz: 689d3d00143dccd3ad8d3fb79fad5f303178258cc7dbe43ad5036d48953c62fc501d748a7e4e3ed944dfb34bf2ce04e114710bc1a5deee7e6ad291c96605ba93
7
+ data.tar.gz: 9edd55c7c642dfe58157c3c69461937cdcb7b76a317cf0055f0ec08da89354aee8b452ca1db59ba9741a4ab2610f10c9c576f7182c08d08b9036ce435a80fc82
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.0.0
4
+ before_install: gem install bundler -v 1.10.6
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in binary-utils.gemspec
4
+ gemspec
@@ -0,0 +1,39 @@
1
+ # Binary::Utils
2
+
3
+ `Binary::Utils.bin_to_hex(Digest::MD5.digest("foo"))` to convert digest
4
+ to hex string
5
+
6
+ `Binary::Utils.hex_to_bin(Digest::MD5.hexdigest("foo"))` to convert
7
+ hexstring to binary.
8
+
9
+
10
+ ## Installation
11
+
12
+ Add this line to your application's Gemfile:
13
+
14
+ ```ruby
15
+ gem 'binary-utils'
16
+ ```
17
+
18
+ And then execute:
19
+
20
+ $ bundle
21
+
22
+ Or install it yourself as:
23
+
24
+ $ gem install binary-utils
25
+
26
+ ## Usage
27
+
28
+ As above
29
+
30
+ ## Development
31
+
32
+ After checking out the repo, run `bundle install` to install dependencies. Then, run `rake spec` to run the tests.
33
+
34
+ To 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).
35
+
36
+ ## Contributing
37
+
38
+ Bug reports and pull requests are welcome on GitHub at https://github.com/livelink/binary-utils.
39
+
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -0,0 +1,31 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'binary/utils/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "binary-utils"
8
+ spec.version = Binary::Utils::VERSION
9
+ spec.authors = ["Geoff Youngs"]
10
+ spec.email = ["git@intersect-uk.co.uk"]
11
+
12
+ spec.summary = %q{Utility function for convert between hexdigest & digest}
13
+ spec.homepage = "http://github.com/livelink/binary-utils"
14
+
15
+ # Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
16
+ # delete this section to allow pushing this gem to any host.
17
+ if spec.respond_to?(:metadata)
18
+ spec.metadata['allowed_push_host'] = "https://rubygems.org"
19
+ else
20
+ raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
21
+ end
22
+
23
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
24
+ spec.bindir = "exe"
25
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
26
+ spec.require_paths = ["lib"]
27
+
28
+ spec.add_development_dependency "bundler", "~> 1.10"
29
+ spec.add_development_dependency "rake", "~> 10.0"
30
+ spec.add_development_dependency "rspec"
31
+ end
@@ -0,0 +1,23 @@
1
+ require "binary/utils/version"
2
+
3
+ module Binary
4
+ module Utils
5
+ module_function
6
+ def hex_to_bin(string)
7
+ as_binary( [string].pack('H*') )
8
+ end
9
+
10
+ def bin_to_hex(string)
11
+ as_binary(string).unpack('H*').first
12
+ end
13
+
14
+ def as_binary(string)
15
+ string = string.to_s
16
+ if string.respond_to?(:force_encoding)
17
+ string.force_encoding('ASCII-8BIT')
18
+ else
19
+ string
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,5 @@
1
+ module Binary
2
+ module Utils
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,95 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: binary-utils
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Geoff Youngs
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2016-02-19 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.10'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.10'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description:
56
+ email:
57
+ - git@intersect-uk.co.uk
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - .gitignore
63
+ - .rspec
64
+ - .travis.yml
65
+ - Gemfile
66
+ - README.md
67
+ - Rakefile
68
+ - binary-utils.gemspec
69
+ - lib/binary/utils.rb
70
+ - lib/binary/utils/version.rb
71
+ homepage: http://github.com/livelink/binary-utils
72
+ licenses: []
73
+ metadata:
74
+ allowed_push_host: https://rubygems.org
75
+ post_install_message:
76
+ rdoc_options: []
77
+ require_paths:
78
+ - lib
79
+ required_ruby_version: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - '>='
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
84
+ required_rubygems_version: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - '>='
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ requirements: []
90
+ rubyforge_project:
91
+ rubygems_version: 2.0.14
92
+ signing_key:
93
+ specification_version: 4
94
+ summary: Utility function for convert between hexdigest & digest
95
+ test_files: []