我有一个在线SMF论坛,当用户注册时,密码在数据库中用SHA1加密.我需要创建一个具有登录功能的vb程序,只有论坛成员才能登录.现在,我陷入困境的部分是如何在Visual Basic中将密码加密为SHA1?我包含了一些我不知道的代码是否正确所以请帮助我.
Imports System.Security.Cryptography
Public Class Form2
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
' declare those variables
Dim password As String
Dim passwordSHA As String
password = txtPassword.Text ' give password the value of the password textbox
Call passwordEncryptSHA(password) ' Lets call the first password encryption function for SHA1
passwordSHA = passwordEncryptSHA(password) ' give the variable the returned SHA value
' finally we will display both values in the corresponding textboxes
txtSHA1.Text = passwordSHA …
Run Code Online (Sandbox Code Playgroud) vb.net ×1