[RESOLVED] need help in converting these codes to vb.net
hi,
can anyone help me convert this code to vb.net?
Code:
private string GenerateSalt() {
byte[] buf = new byte[SALT_SIZE_IN_BYTES];
(new RNGCryptoServiceProvider()).GetBytes(buf);
return Convert.ToBase64String(buf);
}
i tried using conversion tools but gives me an error on the syntax.
Code:
Private Function GenerateSalt() As String
Dim buf As Byte() = New Byte(SALT_SIZE_IN_BYTES - 1) {}
(New RNGCryptoServiceProvider()).GetBytes(buf)
Return Convert.ToBase64String(buf)
End Function
thanks.
Re: need help in converting these codes to vb.net
Code:
Private Function GenerateSalt() As String
Dim buf As Byte() = New Byte(SALT_SIZE_IN_BYTES - 1){}
CType(New RNGCryptoServiceProvider(), RNGCryptoServiceProvider).GetBytes(buf)
Return Convert.ToBase64String(buf)
End Function
:)
Re: need help in converting these codes to vb.net
You aren't allowed to start a line of code with 'New'. This should work:
vb.net Code:
Call (New RNGCryptoServiceProvider()).GetBytes(buf)
Re: need help in converting these codes to vb.net