Ariel,

The cryptography in the .NET framework works using byte arrays.
For a similar result, you'll need to convert from string to byte array your
password, hash it, then reconvert the result into a string.

--- Sample ---

using System.Text;
using System.Security.Cryptography;

...

MD5 md = MD5.Create ();
byte[] digest = md.ComputeHash (Encoding.UTF8.GetBytes (password));
string result = Convert.ToBase64String (digest);

---

Sebastien Pouliot
Security Architect, Motus Technologies, http://www.motus.com/
work: [EMAIL PROTECTED]
home: [EMAIL PROTECTED]

----- Original Message -----
From: "Ariel Rios" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, June 23, 2003 7:40 PM
Subject: [Mono-list] How can I md5 and crypt a string?


> In php I can check if a password is correct by doing something like:
> crypt($user_input,$this->getPassword())
>
> Also I can do
> $hash = md5 ($str);
>
> Is there a way to do so currently in mono?
> --
> Ariel Rios <[EMAIL PROTECTED]>
> --
> Ariel Rios <[EMAIL PROTECTED]>
> Elektra - Gerencia GNU
>
> _______________________________________________
> Mono-list maillist  -  [EMAIL PROTECTED]
> http://lists.ximian.com/mailman/listinfo/mono-list
>


_______________________________________________
Mono-list maillist  -  [EMAIL PROTECTED]
http://lists.ximian.com/mailman/listinfo/mono-list

Reply via email to