back up codes

always have a backup of your code

Archive for the tag “encryption”

encrypting data for database

First create the class:

Imports System.Security.Cryptography
Imports System.Text
Imports Microsoft.VisualBasic
Public Class myencrypted
Public Function toencrypt(ByVal Data As String) As String
Dim myhash As New SHA1Managed
Convert.ToBase64String(myhash.ComputeHash(Encoding.ASCII.GetBytes(Data)))
Dim mybyte() As Byte = ASCIIEncoding.ASCII.GetBytes(Data)
Dim thestring As String = Convert.ToBase64String(mybyte)
toencrypt = thestring
End Function
End Class

Then create this code before data insertion into database:

Dim myencryption As New myencrypted
Dim encrypted As String = myencryption.toencrypt(txtbox.Text)

Post Navigation

Follow

Get every new post delivered to your Inbox.