MOO-Cows

moo-cows Topic: Is there a decrypt?

Article #1082
Subject: Is there a decrypt?
Author: Mark O'Neil
Posted: 3/16/2001 07:12:57 AM

Is there a decrypt which will take a encrypted string and return the
decrypted result?

I have been searching to no avail.

thanks,
-m


Responses:

Article #1083
Subject: Re: Is there a decrypt?
Author: Kai van Poppel
Posted: 3/16/2001 07:25:14 AM

> Is there a decrypt which will take a encrypted string and return the
> decrypted result?

No, MOO's are using the one-way encryption, you cannot decrypt strings.
You can only compare an encrypted string with another string, like passwords
when a player connects.

Example:
if (crypt($command_utils:read("your password"), player.password[1..2]) ==
player.password)
  player:tell("The password is correct.");
else
  player:tell("Incorrect password!");
endif

- Kai van Poppel.


Article #1084
Subject: Re: Is there a decrypt?
Author: McVey,S,Shaun
Posted: 3/16/2001 07:25:58 AM

If you're interested in writing your own encryption/decryption verbs to use
in place of crypt(), you could have a look at some of the algorithms at
http://lor.trincoll.edu/~cpsc/cryptography/index.html. Probably an easy, yet
semi-secure one (at least for MOO purposes) is the Vigenere cipher - you'll
find the link on the page.

I've got the intention of writing a set of encryption/decryption verbs when
I get some time, it will be interesting (if geeky) to see how the MOO copes
with doing 128 bit RSA encryption :-).

At the moment though, I'm working on compression/decompression verbs. For
two reasons, 1) I want to have a File Utility package which overlays the
basic FUP and it compresses files which haven't been accessed in a long time
and 2) Because I like doing geeky things like this.

-Shaun McVey

-----Original Message-----
From: Kai van Poppel [mailto:darkshadow@nospam]
Sent: 16 March 2001 14:25
To: MOO-COWS@nospam
Subject: Re: Is there a decrypt?


> Is there a decrypt which will take a encrypted string and return the
> decrypted result?

No, MOO's are using the one-way encryption, you cannot decrypt strings.
You can only compare an encrypted string with another string, like passwords
when a player connects.

Example:
if (crypt($command_utils:read("your password"), player.password[1..2]) ==
player.password)
  player:tell("The password is correct.");
else
  player:tell("Incorrect password!");
endif

- Kai van Poppel.


Article #1085
Subject: Re: Is there a decrypt?
Author: Robert Sanderson
Posted: 3/16/2001 07:35:45 AM

> Is there a decrypt which will take a encrypted string and return the
> decrypted result?
> I have been searching to no avail.

No. For reasons of security and privacy (and that crypt() just calls the
Unix crypt() function which doesn't have a decrypt() AFAIK)

Have a look at the code for @password for how to compare crypted strings
with non encrypted.

Rob

--
      ,'/:.          Rob Sanderson (azaroth@nospam)
    ,'-/::::.        http://www.o-r-g.org/~azaroth/
  ,'--/::(@)::.      Room 218, French Dept, Liverpool University, ext 2752
,'---/::::::::::.    Syrinnia:  telnet:  syrinnia.o-r-g.org 7777
____/:::::::::::::.                WWW:  http://syrinnia.o-r-g.org:8000/
I L L U M I N A T I


Article #1086
Subject: Re: Is there a decrypt?
Author: Chris Jones
Posted: 3/16/2001 10:03:00 AM

On Fri, 16 Mar 2001, Mark O'Neil wrote:
> Is there a decrypt which will take a encrypted string and return the
> decrypted result?

        For crypt(), no, because it's not actually encrypted (for details,
see "man crypt" on your favorite unix box).  In general, you could code
something in-MOO, but that gets kinda inefficient -- MOO isn't really
designed to do crypto.  With that said, manta (who'll probably pipe up at
some point) has done an amazing number of ciphers in-MOO, including RSA
encryption.  I think it works, too.

        The best route is probably to find a nice crypto library, and
write an extension front-end to it (maybe as a builtin STRING or
LIST_STRING do_<cipher>(STRING key_in_hex, STRING text, INT mode), where
mode would control whether you're encrypting or decrypting....



MOO-Cows Home