bin/krypton in krypton-0.1.7 vs bin/krypton in krypton-0.1.8

- old
+ new

@@ -26,11 +26,11 @@ opts.on('-r', '--raw', 'Set the input and output type to the raw bytes, if available (Default: false)') do options[:raw] = true end - opts.on('-u', '--urlsafe', 'Make output data URL safe (base64)') do + opts.on('-u', '--urlsafe', 'Make output data URL safe (base64) if applicable') do options[:urlsafe] = true end opts.on('--verbose', 'Run verbosely') do $verbose = true @@ -87,12 +87,16 @@ puts "#{data + ' => '}#{Paint[result.strip, '#2ecc71']}" end exit 0 when 'uuid' - puts Paint[SecureRandom.uuid, '#2ecc71'] - + if options[:std] + puts SecureRandom.uuid + else + puts Paint[SecureRandom.uuid, '#2ecc71'] + end + when 'totp' if ARGV.length == 2 puts "You need a secret to generate a totp." exit 1 else @@ -120,10 +124,17 @@ puts Krypton::B64.decode(data, options[:urlsafe]) else puts "#{data + ' => ' + Paint[Krypton::B64.decode(data, options[:urlsafe]),'#2ecc71']}" end exit 0 - + when 'sum' + filename = ARGV[ARGV.length - 1] || gets + if options[:std] + puts Krypton::SHA.checksum(filename, options[:raw]) + else + puts "#{filename} => #{Paint[Krypton::SHA.checksum(filename, options[:raw]), '#2ecc71']}" + end + exit 0 else puts "#{opt} is not a valid action!" exit 1 end end