我应该在我正在从事的这个项目上进行文本加密,我遇到了可以正常工作的代码,但是我不知道这是什么类型的加密,谁能帮助我回答哪种类型的加密?是加密吗?
AES Encryption and Decryption in VB.NET是我从中获得代码的项目的标题。如果是AES
,是AES-128
,AES-192
还是AES-256
?
Public Function AES_Encrypt(ByVal input As String, ByVal pass As String) As String
Try
Dim hash(31) As Byte
Dim temp As Byte() = Hash_AES.ComputeHash(System.Text.ASCIIEncoding.ASCII.GetBytes(pass))
Array.Copy(temp, 0, hash, 0, 16)
Array.Copy(temp, 0, hash, 15, 16)
AES.Key = hash
AES.Mode = Security.Cryptography.CipherMode.ECB
Dim DESEncrypter As System.Security.Cryptography.ICryptoTransform = AES.CreateEncryptor
Dim Buffer As Byte() = System.Text.ASCIIEncoding.ASCII.GetBytes(input)
encrypted = Convert.ToBase64String(DESEncrypter.TransformFinalBlock(Buffer, 0, Buffer.Length))
Return encrypted
Catch ex As Exception
Return input 'If encryption fails, return the unaltered input.
End Try
End Function
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
AES_Encrypt(TextBox1.Text, ")l|_^WR]!u;j$5:(vuU6K5j+9%{U<:FC")
Label1.Text = encrypted
End Sub