HASH password

ok, i found this code to generate a password

PublicSharedFunction HashPassword(ByVal passwordAsString)AsString

Dim shaAsNewSHA1Managed

Dim passwordBytesAsByte() =Encoding.UTF8.GetBytes(password)

'compute the hash

Dim hashAsByte() = sha.ComputeHash(passwordBytes)

Return Convert.ToBase64String(hash)

EndFunction

the thing is i didnt do this function, and the program visual basic underlines the words i put in yellow.. it says

SHA1Managed is not defined

Encoding is not declared

if anyone can help me...or has another hash funcion to generate password i woudl appresiate, i looked all over and couldnt find one for visual basic...

[2171 byte] By [ivanatilca] at [2007-12-25]
# 1

You probably dont have any imports statements at the top of you file, or in you projects for the

system.security.cryptography and system.text namespaces

so you can fully qualify them

Dim sha As New System.Security.Cryptography.SHA1Managed

Dim passwordBytes As Byte() = System.Text.Encoding.UTF8.GetBytes(password)

or add

Imports System.Security.Cryptography

Imports System.Text

spotty at 2007-9-3 > top of Msdn Tech,Visual Studio Express Editions,Visual Basic 2005 Express Edition...
# 2
thanks! that was the problem!
ivanatilca at 2007-9-3 > top of Msdn Tech,Visual Studio Express Editions,Visual Basic 2005 Express Edition...