Sha256: 5d602a4a8db7c711044fdbd74b88eb78e62c92174993e1658708eef0f1f99f7f

Contents?: true

Size: 1.07 KB

Versions: 2

Compression:

Stored size: 1.07 KB

Contents

namespace 'symmetric-encryption' do

  desc 'Decrypt the supplied string. Example: VALUE="Hello World" rake symmetric-encryption:decrypt'
  task :decrypt do
    puts "\nEncrypted: #{ENV['VALUE']}"
    puts "Decrypted: #{Symmetric::Encryption.decrypt(ENV['VALUE'])}\n\n"
  end

  desc 'Encrypt a value, such as a password. Example: rake symmetric-encryption:encrypt'
  task :encrypt do
    require 'highline'
    password1 = nil
    password2 = 0

    while password1 != password2
      password1 = HighLine.new.ask("Enter the value to encrypt:") { |q| q.echo = "*" }
      password2 = HighLine.new.ask("Re-enter the value to encrypt:") { |q| q.echo = "*" }

      if (password1 != password2)
        puts "Passwords do not match, please try again"
      end
    end
    puts "\nEncrypted: #{Symmetric::Encryption.encrypt(password1)}\n\n"
  end

  desc 'Generate a random password and display its encrypted form'
  task :random_password do
    p = Symmetric::Encryption.random_password
    puts "\nGenerated Password: #{p}"
    puts "Encrypted: #{Symmetric::Encryption.encrypt(p)}\n\n"
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
symmetric-encryption-0.1.0 lib/symmetric/railties/symmetric_encryption.rake
symmetric-encryption-0.0.1 lib/symmetric/railties/symmetric-encryption.rake