decrypt this!

Discussion in 'Ruby' started by aktxyz@gmail.com, Jan 31, 2008.

  1. Guest

    Here is some code that adds encrypt/decrypt methods to string, quite
    handy.
    Problem is, I need to decrypt in .NET !!
    any idea how?

    =============================


    require 'openssl'

    $key = "A75435F0B240012A9489000C2952E41F"

    class String

    def encrypt(key=$key)
    e = OpenSSL::Cipher::Cipher.new 'DES-EDE3-CBC'
    e.encrypt key
    s = e.update self
    s << e.final
    s = s.unpack('H*')[0].upcase
    s
    end

    def decrypt(key=$key)
    e = OpenSSL::Cipher::Cipher.new 'DES-EDE3-CBC'
    e.decrypt key
    s = self.to_a.pack("H*").unpack("C*").pack("c*")
    s = e.update s
    s << e.final
    s
    end

    end

    puts "hi there".encrypt


    irb(main):027:0* puts "hi there".encrypt
    A5C7BBF5CBDFE2EC0D5F3B55AC12B761
    , Jan 31, 2008
    #1
    1. Advertising

  2. yermej Guest

    On Jan 31, 9:42 am, "" <> wrote:
    > Here is some code that adds encrypt/decrypt methods to string, quite
    > handy.
    > Problem is, I need to decrypt in .NET !!
    > any idea how?


    Google?
    A .NET newsgroup/mailing list/forum?
    Use ruby2exe to create an executable and call that from .NET?
    Create a Ruby web service and call that from .NET?
    yermej, Jan 31, 2008
    #2
    1. Advertising

  3. Kyle Schmitt Guest

    On Jan 31, 2008 9:49 AM, yermej <> wrote:
    > On Jan 31, 9:42 am, "" <> wrote:
    > > Here is some code that adds encrypt/decrypt methods to string, quite
    > > handy.
    > > Problem is, I need to decrypt in .NET !!
    > > any idea how?

    >
    > Google?
    > A .NET newsgroup/mailing list/forum?
    > Use ruby2exe to create an executable and call that from .NET?
    > Create a Ruby web service and call that from .NET?
    >
    >


    You have two options. Go to msdn, search for what you want (it's in
    the standard .net libs), or use visual studio and let intelisense fill
    in everything for you, and _READ_ the popups that come up.

    What of the (few) good things that can be said about .net is that it's
    got almost everything in the world built in. What you're describing
    should end up being about a 12-20 line vb.net program, double that if
    you include comments, quadruple if try and do error handling (It's an
    ugly language ;)

    --Kyle
    Kyle Schmitt, Feb 1, 2008
    #3
  4. Kyle Schmitt Guest

    One of, not what of. Phew.

    On Feb 1, 2008 11:59 AM, Kyle Schmitt <> wrote:
    >
    > On Jan 31, 2008 9:49 AM, yermej <> wrote:
    > > On Jan 31, 9:42 am, "" <> wrote:
    > > > Here is some code that adds encrypt/decrypt methods to string, quite
    > > > handy.
    > > > Problem is, I need to decrypt in .NET !!
    > > > any idea how?

    > >
    > > Google?
    > > A .NET newsgroup/mailing list/forum?
    > > Use ruby2exe to create an executable and call that from .NET?
    > > Create a Ruby web service and call that from .NET?
    > >
    > >

    >
    > You have two options. Go to msdn, search for what you want (it's in
    > the standard .net libs), or use visual studio and let intelisense fill
    > in everything for you, and _READ_ the popups that come up.
    >
    > What of the (few) good things that can be said about .net is that it's
    > got almost everything in the world built in. What you're describing
    > should end up being about a 12-20 line vb.net program, double that if
    > you include comments, quadruple if try and do error handling (It's an
    > ugly language ;)
    >
    > --Kyle
    >
    Kyle Schmitt, Feb 1, 2008
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    1
    Views:
    483
    Jonathan Allen
    Sep 25, 2004
  2. skech
    Replies:
    3
    Views:
    499
    srinvias moorthy
    Dec 4, 2003
  3. Mark

    Encrypt/decrypt info from form

    Mark, Feb 6, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    1,497
    William LaMartin
    Feb 6, 2004
  4. Augusto Rocha

    How do I decrypt a SHA stored password?

    Augusto Rocha, Feb 19, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    15,572
    Karl Jensen
    Feb 19, 2004
  5. Replies:
    1
    Views:
    423
    Daniel Martin
    Jun 16, 2007
Loading...

Share This Page