Permalink
Browse files

Improve encrypt/decrypt for non-CLI use

  • Loading branch information...
1 parent 9b3ddea commit ee7cb4a85ff65c9b14a67c846c00431f87e95250 @demonbane committed Sep 19, 2011
Showing with 7 additions and 7 deletions.
  1. +7 −7 lib/pipefish.rb
View
@@ -40,7 +40,7 @@ def execute(*args)
opts.parse!(args)
- send(@action)
+ puts send(@action, STDIN.read.to_s)
exit
end
@@ -57,13 +57,13 @@ def key=(enkey)
@key = enkey
end
- def encrypt
- payload = Base64.encode64(STDIN.read)
- puts Base64.encode64(blowfish.encrypt_string(payload))
+ def encrypt(payload)
+ encoded_text = Base64.encode64(payload)
+ Base64.encode64(blowfish.encrypt_string(encoded_text))
end
- def decrypt
- payload = Base64.decode64(STDIN.read)
- puts Base64.decode64(blowfish.decrypt_string(payload))
+ def decrypt(payload)
+ decoded_text = Base64.decode64(payload)
+ Base64.decode64(blowfish.decrypt_string(decoded_text))
end
end

0 comments on commit ee7cb4a

Please sign in to comment.