summaryrefslogtreecommitdiffstats
path: root/ext/openssl/sample/cipher.rb
diff options
context:
space:
mode:
authornahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-09-04 10:31:29 +0000
committernahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-09-04 10:31:29 +0000
commit9bf2911d74cc5b6d8697acb6ed4e6c39b2b74f1e (patch)
treeacc6999a9b0b08b1bd645d0eadb9553d7c034b32 /ext/openssl/sample/cipher.rb
parent18facc3b3a67240e6ad860c41f57c88ddeebcd3d (diff)
downloadruby-9bf2911d74cc5b6d8697acb6ed4e6c39b2b74f1e.tar.gz
ruby-9bf2911d74cc5b6d8697acb6ed4e6c39b2b74f1e.tar.xz
ruby-9bf2911d74cc5b6d8697acb6ed4e6c39b2b74f1e.zip
* sample/openssl: added. Sample of standard distribution library should be
locate in sample/{module_name}/*. * ext/openssl/sample/*: removed. move to sample/openssl/*. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@4492 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/openssl/sample/cipher.rb')
-rw-r--r--ext/openssl/sample/cipher.rb29
1 files changed, 0 insertions, 29 deletions
diff --git a/ext/openssl/sample/cipher.rb b/ext/openssl/sample/cipher.rb
deleted file mode 100644
index 844b6eea4..000000000
--- a/ext/openssl/sample/cipher.rb
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/usr/bin/env ruby
-require 'openssl'
-
-text = "abcdefghijklmnopqrstuvwxyz"
-key = "key"
-alg = "DES-EDE3-CBC"
-#alg = "AES-128-CBC"
-
-puts "--Setup--"
-puts %(clear text: "#{text}")
-puts %(symmetric key: "#{key}")
-puts %(cipher alg: "#{alg}")
-puts
-
-puts "--Encrypting--"
-des = OpenSSL::Cipher::Cipher.new(alg)
-des.encrypt(key) #, "iv12345678")
-cipher = des.update(text)
-cipher << des.final
-puts %(encrypted text: #{cipher.inspect})
-puts
-
-puts "--Decrypting--"
-des = OpenSSL::Cipher::Cipher.new(alg)
-des.decrypt(key) #, "iv12345678")
-out = des.update(cipher)
-out << des.final
-puts %(decrypted text: "#{out}")
-puts