Skip to content

Commit

Permalink
replace SecureRandom with a safer alternative Sysrandom
Browse files Browse the repository at this point in the history
  • Loading branch information
xorond committed Oct 1, 2016
1 parent d81ac3b commit 36b9972
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
source 'https://rubygems.org'
gem 'highline', :require => 'highline/import'
gem 'zxcvbn-ruby', :require => 'zxcvbn'
gem 'sysrandom', :require => 'sysrandom'
group :optional do
gem 'clipboard'
gem 'ffi', :platforms => [:mswin, :mingw]
Expand Down
4 changes: 3 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ GEM
specs:
clipboard (1.1.1)
highline (1.7.8)
sysrandom (1.0.3)
zxcvbn-ruby (0.1.1)

PLATFORMS
Expand All @@ -12,7 +13,8 @@ DEPENDENCIES
clipboard
ffi
highline
sysrandom
zxcvbn-ruby

BUNDLED WITH
1.13.1
1.13.2
4 changes: 2 additions & 2 deletions passtrust
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def print_password(word)
end

if $options.clipboard
3.times { Clipboard.copy truncate(magic(SecureRandom.base64)) }
3.times { Clipboard.copy truncate(magic(Sysrandom.hex(16))) }
end
cls
end
Expand Down Expand Up @@ -116,7 +116,7 @@ def main
# disable clipboard option if clipboard gem is not loaded
$options.clipboard = false if not defined?(Clipboard)

(puts "Your random passphrase is: " ; print_password(magic(p SecureRandom.base64)); exit 130) if $options.random
(puts "Your random passphrase is: " ; print_password(magic(p Sysrandom.hex(16))); exit 130) if $options.random

puts green("Secret mode is activated") if $options.secret

Expand Down

0 comments on commit 36b9972

Please sign in to comment.