You are here:
Vanderbilt Biostatistics Wiki
>
Main Web
>
RubyLangEncryption
(24 May 2006,
CharlesDupont
)
(raw view)
E
dit
A
ttach
---++ Encrypting text in ruby ---+++ Available Ciphers Can use any of these ciphers * blowfish * cast * des * idea * rc2 * rc4 * rc5 * dsa * dh * rsa ---+++ Example Code This is How you encrypt things in ruby To encrypt <verbatim> require 'openssl' cipher = OpenSSL::Cipher::Cipher.new( "des-ecb" ) cipher.encrypt cipher.key = key_to_use cipher.iv = iv_to_use output = cipher.update( data_to_encrypt ) output << cipher.update( more_data_to_encrypt ) output << cipher.final </verbatim> Or, to decrypt: <verbatim> cipher = OpenSSL::Cipher::Cipher.new( "des-ecb" ) cipher.decrypt cipher.key = key_to_use cipher.iv = iv_to_use output = cipher.update( data_to_dencrypt ) output << cipher.update( more_data_to_dencrypt ) output << cipher.final </verbatim>
E
dit
|
A
ttach
|
P
rint version
|
H
istory
: r1
|
B
acklinks
|
V
iew topic
|
Edit
w
iki text
|
M
ore topic actions
Topic revision: r1 - 24 May 2006,
CharlesDupont
Main
Department Home Page
Biostatistics Graduate Program
Vanderbilt University Medical Center
Main Web
Main Web Home
Search
Recent Changes
Changes
Topic list
Biostatistics Webs
Archive
Main
Sandbox
System
Register
|
Log In
Copyright © 2013-2022 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Vanderbilt Biostatistics Wiki?
Send feedback