dev-random-passwords 0.0.3 → 0.0.4

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8c871a256ac5a707cd16dcaeb3ffa8c07e0240c5
4
- data.tar.gz: 76c308d9bc59e2fa2b3f6d2396b50284c5c2edb7
3
+ metadata.gz: 75a52c16107bcf33418c0833c688bc2338312aa2
4
+ data.tar.gz: f43f98d9fc24725fc097e033e798bd6523017a25
5
5
  SHA512:
6
- metadata.gz: 7122d2b0b9e31a4b667c4e0282471cce0be4b02d08ad42aba9ecfc5f09423d83a35d0c70faf7e47f452ff278e529cc61bdb221b855ad11833b5904e886539bf4
7
- data.tar.gz: c4c8f1ecd9e7590c6fa0c7445f626206ff627cbe71d713d0a2e4538c79cf0377ce2e325cc1de99840585ca59c97e5987b8003de6249f334a1e4f5c184cbb640b
6
+ metadata.gz: c8e0bc1379fbd84cf2e133c369f30b193a5eb5dda35fd2844830eab5362fa9f304f09f2c43217bed26edf8b706bc6facc46e92e0be4bf09cb421d5ecd878a2cd
7
+ data.tar.gz: 9bc0171fbc849e167a2e4c05dfd0bf5145bab7ae987d16453800073765b2ff5ada91e39565cde77cda8f5aecf76da288723070deebbfaac9d19630df61c246a9
data/.gitignore CHANGED
@@ -11,4 +11,5 @@
11
11
  *.so
12
12
  *.o
13
13
  *.a
14
+ *.gem
14
15
  mkmf.log
data/README.md CHANGED
@@ -20,6 +20,35 @@ Or install it yourself as:
20
20
  $ gem install dev-random-passwords
21
21
 
22
22
  ## Usage
23
+
24
+ ### From command line
25
+
26
+ Simply install the gem and run "randompasswords"
27
+ ```
28
+ $ randompasswords
29
+ dV>28l,T
30
+ ```
31
+
32
+ Use -l to specify chracter length
33
+ ```
34
+ $ randompasswords -l 16
35
+ U[3wjY?]~h$26s!Q
36
+ ```
37
+ Use -c to set which character types you want to use (uppercase, lowercase, digits or special)
38
+ ```
39
+ $ randompasswords -l 16 -c lowercase,uppercase
40
+ cxtDCjIaTFmHnlba
41
+ ```
42
+
43
+ Use -i to include certain characters or -e to exclude them
44
+ ```
45
+ $ randompasswords -c digits -l 54 -e 23456789
46
+ 010000101100100111000010000111101010011101110010011011
47
+ ```
48
+
49
+ Run "randompasswords -h" for full set of options and description
50
+
51
+ ### For programming
23
52
  Require the gem
24
53
 
25
54
  ```ruby
@@ -16,8 +16,29 @@ module DevRandomPasswords
16
16
  end
17
17
 
18
18
  def get_byte
19
- dev_random = File.new("/dev/random", 'r')
20
- dev_random.read(1).ord
19
+ if File.exist?('/dev/hwrng')
20
+ if File.readable?('/dev/hwrng')
21
+ random_file = File.new('/dev/hwrng', 'r')
22
+ random_byte = random_file.read(1).ord
23
+ random_file.close
24
+ return random_byte
25
+ else
26
+ raise "/dev/hwrng is not readable by the current user please change permissions on this file"
27
+ end
28
+
29
+ elsif File.exist?('/dev/random')
30
+ if File.readable?('/dev/random')
31
+ random_file = File.new('/dev/random', 'r')
32
+ random_byte = random_file.read(1).ord
33
+ random_file.close
34
+ return random_byte
35
+ else
36
+ raise "/dev/random is not readable by the current user please change permissions on this file"
37
+ end
38
+
39
+ else
40
+ raise "Could not find a random number generator on your system"
41
+ end
21
42
  end
22
43
 
23
44
  def set_options(options={
@@ -1,3 +1,3 @@
1
1
  module DevRandomPasswords
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dev-random-passwords
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joel Smith
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-19 00:00:00.000000000 Z
11
+ date: 2014-09-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -54,8 +54,6 @@ files:
54
54
  - README.md
55
55
  - Rakefile
56
56
  - bin/randompasswords
57
- - dev-random-passwords-0.0.1.gem
58
- - dev-random-passwords-0.0.2.gem
59
57
  - dev-random-passwords.gemspec
60
58
  - lib/.DS_Store
61
59
  - lib/dev-random-passwords.rb
Binary file
Binary file