hashdata 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md CHANGED
@@ -1,15 +1,29 @@
1
+ [![Gem Version](https://badge.fury.io/rb/hashdata.png)](http://badge.fury.io/rb/hashdata)
1
2
  # HashData
2
3
  A REPL for hashing, encoding, and encryption identification. The listings aren't complete and will generally give numerous possibilities for each input due to the nature of a lot of functions having output in a similar format.
3
4
 
4
5
  ![Screenshot](screenshot.png?raw=true)
5
6
 
6
- ## Usage
7
+ ## Install
7
8
  ```bash
8
9
  $ gem install hashdata
9
10
  ```
10
11
 
12
+ ## Usage
13
+ #### Command Line
11
14
  When installed, run `hashdata` and paste in hashes when prompted.
12
15
 
16
+ #### Library
17
+
18
+ Example Script:
19
+ ```ruby
20
+ require 'hashdata'
21
+ hash = HashData.new
22
+ puts(hash.check_type("1111111111111",'DES'))
23
+ ```
24
+ Should output true. The library only matches the start of your second input, this means that you can check something is an
25
+ MD5 hash without having to worry about wether it is from Joomla or Unix for example.
26
+
13
27
  ## Supports
14
28
  - Adler32
15
29
  - Blowfish(Eggdrop), Blowfish(OpenBSD)
data/Rakefile CHANGED
@@ -1 +1 @@
1
- require 'bundler/gem_tasks'
1
+ require 'bundler/gem_tasks'
@@ -5,7 +5,7 @@ $LOAD_PATH.unshift(File.dirname(File.realpath(__FILE__)) + '/../lib')
5
5
  require 'hashdata'
6
6
 
7
7
  puts 'Use Ctrl+C to exit program.'
8
- hash = HashChecker.new
8
+ hash = HashData.new
9
9
 
10
10
  loop do
11
11
  print('Enter your Hash: ')
@@ -4,13 +4,13 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = 'hashdata'
7
- spec.version = '0.0.1'
7
+ spec.version = '0.0.2'
8
8
  spec.authors = ['Sam Brown']
9
9
  spec.email = ['samdanielbrown@gmail.com']
10
10
  spec.summary = %q{A command line Hash Identifying tool.}
11
11
  spec.homepage = 'https://github.com/sam-b/HashData'
12
12
  spec.license = 'MIT'
13
-
13
+ spec.description = 'A command line hash identifying tool and checking library.'
14
14
  spec.files = `git ls-files -z`.split("\x0")
15
15
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
16
16
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
@@ -18,4 +18,5 @@ Gem::Specification.new do |spec|
18
18
 
19
19
  spec.add_development_dependency 'bundler', '~> 1.5'
20
20
  spec.add_development_dependency 'rake', '~> 10.1'
21
+ spec.add_development_dependency 'rspec', '~> 2.14.5'
21
22
  end
@@ -1,9 +1,9 @@
1
- class HashChecker
1
+ class HashData
2
2
  PATTERNS = [
3
3
  [/^[a-f0-9]{4}$/, 'CRC-16, CRC-16-CCITT, FCS-16'],
4
4
  [/^[a-f0-9]{8}$/, 'Adler32, CRC-32, CRC-32B, FCS-32, GHash-32-3, GHash-32-5, XOR-32, FNV-132, Joaat'],
5
5
  [/^\+[a-z0-9\/\.]{12}$/, 'Blowfish(Eggdrop)'],
6
- [/^.{0,2}[a-z0-9\/\.]{11}$/, 'DES(Unix)'],
6
+ [/^.{0,2}[a-zA-Z0-9\/\.]{11}$/, 'DES(Unix)'],
7
7
  [/^[a-f0-9]{16}$/, 'MySQL3.x, LM, DES(Oracle), VNC, FNV-164'],
8
8
  [/^[a-z0-9\/\.]{16}$/, 'MD5(Cisco PIX)'],
9
9
  [/^\$1\$.{0,8}\$[a-z0-9\/\.]{22}$/, 'MD5(Unix)'],
@@ -44,4 +44,11 @@ class HashChecker
44
44
  def check(input)
45
45
  PATTERNS.map { |i| i[1] if i[0].match(input) }.compact.uniq.join(', ')
46
46
  end
47
+
48
+ def check_type(input, hashtype)
49
+ PATTERNS.each do |i|
50
+ return true if i[0].match(input) and i[1].start_with?(hashtype)
51
+ end
52
+ false
53
+ end
47
54
  end
@@ -0,0 +1,12 @@
1
+ require 'hashdata'
2
+ require 'rspec'
3
+
4
+ # Generated using the python "crypt" library for the string 'hashdata' with a salt of 'hashdata':
5
+ # >> python version 2.7.1<<
6
+ # import crypt
7
+ # crypt.crypt('hashdata','hashdata')
8
+ describe HashData do
9
+ it 'recognizes a DES(UNIX) hash' do
10
+ HashData.new.check_type('haLgYBnzoVJi6','DES(Unix)').should eq(true)
11
+ end
12
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hashdata
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-02-10 00:00:00.000000000 Z
12
+ date: 2014-02-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -43,7 +43,23 @@ dependencies:
43
43
  - - ~>
44
44
  - !ruby/object:Gem::Version
45
45
  version: '10.1'
46
- description:
46
+ - !ruby/object:Gem::Dependency
47
+ name: rspec
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
53
+ version: 2.14.5
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: 2.14.5
62
+ description: A command line hash identifying tool and checking library.
47
63
  email:
48
64
  - samdanielbrown@gmail.com
49
65
  executables:
@@ -60,6 +76,7 @@ files:
60
76
  - hashdata.gemspec
61
77
  - lib/hashdata.rb
62
78
  - screenshot.png
79
+ - test/hashdata_spec.rb
63
80
  homepage: https://github.com/sam-b/HashData
64
81
  licenses:
65
82
  - MIT
@@ -85,4 +102,5 @@ rubygems_version: 1.8.23
85
102
  signing_key:
86
103
  specification_version: 3
87
104
  summary: A command line Hash Identifying tool.
88
- test_files: []
105
+ test_files:
106
+ - test/hashdata_spec.rb