Cryptography SHA-256 algorithm in VB.NET

In this article you will learn that how to implement SHA-256 Algorithm for a Login form.
  • 9221
Download Files:
 

Introduction

Here in this article I am explaining that how to implement a login form with the help of SHA-256 Cryptography algorithm. SHA-256 is a standard method for generating digital signature. It is a one way algorithm. The SHA256 algorithm is known as one way encryption, hash or checksum, digest and digital signature algorithm. The SHA core provide implementation of cryptographic Hashes SHA-1, SHA-2, SHA-256, SHA-512.

Getting Started

  • Simply create a new windows application. 
  • Drag two TextBox, two Label and one Button control on your form. Your form will look like below.

    SHA256.gif
     
  • Then add the below code.

       
    Private Sub userLogin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
            userLogin.Click
            If txtUsername.Text.ToUpper <> "SHALINI" Then
                MessageBox.Show(" showing Error: Username doesn't exists.")
                Exit Sub
            End If
            Dim shaM As New SHA256Managed()
            If shaM.ComputeHash(txtvalidpassword.Text) <> "JUNEJA" Then
                MessageBox.Show("Error: Password doesn't match.")
                Exit Sub
            Else
                MessageBox.Show("Welcome users you are now logged in to the data page.Now you can see all
            information about data!"
    )
            End If
        End Sub

     
  • Now run your application.

Output

SHA256-1.gif

SHA256-2.gif

SHA256-3.gif

SHA256-4.gif

SHA256-5.gif

Summary

In this article you learned that how to implement SHA-256 algorithm.

Categories

More Articles

© 2018 DotNetHeaven. All rights reserved.