Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > decrypt this!

Reply
Thread Tools

decrypt this!

 
 
aktxyz@gmail.com
Guest
Posts: n/a
 
      01-31-2008
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
 
Reply With Quote
 
 
 
 
yermej
Guest
Posts: n/a
 
      01-31-2008
On Jan 31, 9:42 am, "akt...@gmail.com" <akt...@gmail.com> 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?
 
Reply With Quote
 
 
 
 
Kyle Schmitt
Guest
Posts: n/a
 
      02-01-2008
On Jan 31, 2008 9:49 AM, yermej <> wrote:
> On Jan 31, 9:42 am, "akt...@gmail.com" <akt...@gmail.com> 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

 
Reply With Quote
 
Kyle Schmitt
Guest
Posts: n/a
 
      02-01-2008
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, "akt...@gmail.com" <akt...@gmail.com> 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
>


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
decrypt challenge - perl encrypt with ruby decrypt aktxyz@gmail.com Ruby 1 06-16-2007 01:30 PM
%CRYPTO-4-RECVD_PKT_MAC_ERR: decrypt: mac verify failed James Harris Cisco 2 02-13-2005 08:15 AM
Encrypt/Decrypt a structured file kevininstructor@state.or.us ASP .Net 1 09-25-2004 05:25 AM
Encrypt/decrypt info from form Mark ASP .Net 1 02-06-2004 09:45 PM
I need crypt and decrypt basic sample skech ASP .Net 3 12-04-2003 01:32 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57