Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi everyone,

 

Greetings from me to all of you. I'm a newbie here :D . Well anyway, I need to ask something.

 

I am trying to encrypt a password. I am using the MD5CryptoServiceProvider Class (Any other suggestions???). To compute the hash code, that class has a method called ComputeHash. This method accepts an array of Bytes as its

argument.

 

So ... the password were given in type String. I've look in the documentation, but I can't find anything about converting a String to an array of Bytes. So ... I can't continue my work. Up to this point, that's the last thing I need to do to finish my work. Please help. Thanks.

 

-amir

Amir Syafrudin
Posted

Dim MyString As String = "yadda yadda yaa"

Dim MyByteArray() As Byte

Dim MyEncoding As New System.Text.ASCIIEncoding

 

MyByteArray = MyEncoding.GetBytes(MyString)

"Everything should be made as simple as possible, but not simpler."

"It's not that I'm so smart , it's just that I stay with problems longer ."

- Albert Einstein

Posted

Thanks to DR00ME and PlausiblyDamp.

 

You know, below is my code ...

 

             '===Hashing current password
             For Each character As Char In tmpPass
                  currPass(0) = System.Convert.ToByte(character)
                  cryptedPass = Me.crypter.ComputeHash(currPass)
                  currentPass = currentPass & cryptedPass(0).ToString
             Next
             '===  

 

I actually convert one character by one character in the input String to Byte and then I hash that character. It's kind a straight forward isn't it. :D

 

Well anyway, thanks again. :)

Amir Syafrudin

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...