ssh-fingerprint 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 08ebf5095afc286cb82dc1df74b4475358733e58
4
+ data.tar.gz: e182bebbbaae853aff989e1bae5a21490dc87649
5
+ SHA512:
6
+ metadata.gz: 3ba71c53bd2c0e5117728e44d8a55ff05d7695946b72dbb480b32dd853deb7c43437cb3beea646290dba6e09334646fd142fbeade9abbee08a711fb8b45d07ee
7
+ data.tar.gz: 8d093878b28633725e25622d94b849df12e631667393756cda82ad0bc9c56a7b894c1f08e1b4d25a8c50b70a996123687c51965a8b7b4ec05f142b49a07ea854
data/.gitignore ADDED
@@ -0,0 +1,18 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ coverage
6
+ InstalledFiles
7
+ lib/bundler/man
8
+ pkg
9
+ rdoc
10
+ spec/reports
11
+ test/tmp
12
+ test/version_tmp
13
+ tmp
14
+
15
+ # YARD artifacts
16
+ .yardoc
17
+ _yardoc
18
+ doc/
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - "1.9.3"
4
+ - "2.0.0"
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,27 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ ssh-fingerprint (0.0.1)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ diff-lcs (1.2.5)
10
+ rake (10.1.1)
11
+ rspec (2.14.1)
12
+ rspec-core (~> 2.14.0)
13
+ rspec-expectations (~> 2.14.0)
14
+ rspec-mocks (~> 2.14.0)
15
+ rspec-core (2.14.7)
16
+ rspec-expectations (2.14.4)
17
+ diff-lcs (>= 1.1.3, < 2.0)
18
+ rspec-mocks (2.14.4)
19
+
20
+ PLATFORMS
21
+ ruby
22
+
23
+ DEPENDENCIES
24
+ bundler (~> 1.5)
25
+ rake (~> 10.1)
26
+ rspec (~> 2.14)
27
+ ssh-fingerprint!
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2014 Victor Gama
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
+ the Software, and to permit persons to whom the Software is furnished to do so,
10
+ subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,37 @@
1
+ ssh-fingerprint
2
+ ===============
3
+ [![Build Status](https://travis-ci.org/victorgama/has_gravatar.png?branch=master)](https://travis-ci.org/victorgama/ssh-fingerprint) [![Dependency Status](https://gemnasium.com/victorgama/has_gravatar.png)](https://gemnasium.com/victorgama/ssh-fingerprint)
4
+
5
+ Generate a fingerprint given an SSH public key (without `ssh-keygen` or external dependencies)
6
+
7
+ Installing
8
+ ----------
9
+
10
+ ssh-fingerprint is distributed as a gem. Install it through the `gem` command or add it to your `Gemfile`:
11
+
12
+ **Installing through `gem`**
13
+ ```
14
+ $ gem install ssh-fingerprint
15
+ ```
16
+
17
+ **Installing through your `Gemfile`**
18
+ ```ruby
19
+ gem 'ssh-fingerprint'
20
+ ```
21
+
22
+ Usage
23
+ -----
24
+
25
+ Using it is really simple. Read the key content to a variable and call `SSHFingerprint.compute` method. Example:
26
+
27
+ ```ruby
28
+ require 'ssh-fingerprint'
29
+
30
+ key = File.read(File.expand_path('~/.ssh/id_rsa.pub'))
31
+ puts SSHFingerprint.compute(key)
32
+ # => f5:d8:39:1d:7c:26:...
33
+ ```
34
+
35
+ -------
36
+
37
+ Pull requests are welcome!
data/Rakefile ADDED
@@ -0,0 +1,7 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new
5
+
6
+ task default: :spec
7
+ task test: :spec
@@ -0,0 +1,3 @@
1
+ require 'ssh_fingerprint/version'
2
+ require 'ssh_fingerprint/core'
3
+
@@ -0,0 +1,16 @@
1
+ require 'digest/md5'
2
+ require 'base64'
3
+
4
+ class SSHFingerprint
5
+ class << self
6
+ PUBRE = /^(ssh-[dr]s[as]\s+)|(\s+.+\@.+)|\n/
7
+ COLONS = /(.{2})(?=.)/
8
+
9
+ def compute(key)
10
+ key.gsub!(PUBRE, '')
11
+ key = Base64.decode64(key)
12
+ key = Digest::MD5.hexdigest(key)
13
+ key.gsub(COLONS, '\1:')
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,6 @@
1
+ class SSHFingerprint
2
+ @@VERSION = "0.0.1"
3
+ def self.VERSION
4
+ @@VERSION
5
+ end
6
+ end
@@ -0,0 +1,14 @@
1
+ require 'ssh_fingerprint'
2
+
3
+ describe 'Fingerprint' do
4
+ let(:key) do
5
+ File.read(File.expand_path('../../support/id_rsa.pub', __FILE__))
6
+ end
7
+
8
+ # Obtained through ssh-keygen -lf ../support/id_rsa.pub
9
+ let(:known_fingerprint) { 'f5:d8:39:1d:7c:26:0c:07:97:b2:d5:09:2f:dd:45:e4' }
10
+
11
+ it 'should match known fingerprint' do
12
+ SSHFingerprint.compute(key).should eq(known_fingerprint)
13
+ end
14
+ end
@@ -0,0 +1 @@
1
+ ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDF4JH0IXRTZBac4VZuHtmHx2uTujZVMxSfvX6ZsBfT1sBUL4Wwnw1pIvT3bu4UCakm9venMaEI4lp/uwlsD7Gcn2Hb2ISBwzWtl+ZsGzUOu6kSrii95h7U6aF87jDSeOdaNtmj2Ss08Rotcmfupt3iVsBCrwRLvaKD07vvBwPtRicYTctK04RUnMtjDPsRNMhfbQIXzFwuJMHsIG+pgOe2ETArexRavy6p2RbvT7MBm1mBQx+LKI9gTjFOx4SdADMUy+TQoJ+Cmm4IIlC+raH6R6erXVEz0iD97i7TwVfNWrlSWIBgEosGIyCxbvjQzMFKKnjzZo8uR6XKYdNey7dV hey@vito.io
@@ -0,0 +1,25 @@
1
+ # encoding: utf-8
2
+
3
+ lib = File.expand_path('../lib', __FILE__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+ require 'ssh_fingerprint/version'
6
+
7
+ Gem::Specification.new do |spec|
8
+ spec.name = 'ssh-fingerprint'
9
+ spec.version = SSHFingerprint.VERSION
10
+ spec.authors = ['Victor Gama']
11
+ spec.email = ['hey@vito.io']
12
+ spec.description = %q{Generate a fingerprint given an SSH public key (without `ssh-keygen` or external dependencies)}
13
+ spec.summary = %q{SSH fingerprint generator}
14
+ spec.homepage = 'http://github.com/victorgama/ssh-fingerprint'
15
+ spec.license = 'MIT'
16
+
17
+ spec.files = `git ls-files`.split($/)
18
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
20
+ spec.require_paths = ["lib"]
21
+
22
+ spec.add_development_dependency 'bundler', '~> 1.5'
23
+ spec.add_development_dependency 'rake', '~> 10.1'
24
+ spec.add_development_dependency 'rspec', '~> 2.14'
25
+ end
metadata ADDED
@@ -0,0 +1,103 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ssh-fingerprint
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Victor Gama
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-01-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.5'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.5'
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.1'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.1'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '2.14'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '2.14'
55
+ description: Generate a fingerprint given an SSH public key (without `ssh-keygen`
56
+ or external dependencies)
57
+ email:
58
+ - hey@vito.io
59
+ executables: []
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - ".gitignore"
64
+ - ".rspec"
65
+ - ".travis.yml"
66
+ - Gemfile
67
+ - Gemfile.lock
68
+ - LICENSE
69
+ - README.md
70
+ - Rakefile
71
+ - lib/ssh_fingerprint.rb
72
+ - lib/ssh_fingerprint/core.rb
73
+ - lib/ssh_fingerprint/version.rb
74
+ - spec/lib/ssh_fingerprint_spec.rb
75
+ - spec/support/id_rsa.pub
76
+ - ssh-fingerprint.gemspec
77
+ homepage: http://github.com/victorgama/ssh-fingerprint
78
+ licenses:
79
+ - MIT
80
+ metadata: {}
81
+ post_install_message:
82
+ rdoc_options: []
83
+ require_paths:
84
+ - lib
85
+ required_ruby_version: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ required_rubygems_version: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - ">="
93
+ - !ruby/object:Gem::Version
94
+ version: '0'
95
+ requirements: []
96
+ rubyforge_project:
97
+ rubygems_version: 2.2.0
98
+ signing_key:
99
+ specification_version: 4
100
+ summary: SSH fingerprint generator
101
+ test_files:
102
+ - spec/lib/ssh_fingerprint_spec.rb
103
+ - spec/support/id_rsa.pub