Skip to content

Instantly share code, notes, and snippets.

View ShaneGowland's full-sized avatar

Shane Gowland ShaneGowland

View GitHub Profile
@ShaneGowland
ShaneGowland / AES Encryption and Decryption in VB.NET
Created July 11, 2013 09:27
AES Encryption and Decryption in VB.NET
Public Function AES_Encrypt(ByVal input As String, ByVal pass As String) As String
Dim AES As New System.Security.Cryptography.RijndaelManaged
Dim Hash_AES As New System.Security.Cryptography.MD5CryptoServiceProvider
Dim encrypted 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