dev-resources.site
for different kinds of informations.
VB .Net: Secure Password
Published at
12/9/2024
Categories
vb
security
cryptography
password
Author
vblover_programmer
Author
18 person written this
vblover_programmer
open
SecurePassword Class:
Imports System.Text
Imports System.Security.Cryptography
Public Class SecurePassword
Protected Friend Shared Function GetMd5Hash(ByVal input As String) As String
' Create a new instance of the MD5 object.
Dim md5Hasher As MD5 = MD5.Create()
' Convert the input string to a byte array and compute the hash.
Dim data As Byte() = md5Hasher.ComputeHash(Encoding.Default.GetBytes(input))
' Create a new Stringbuilder to collect the bytes
' and create a string.
Dim sBuilder As New StringBuilder()
' Loop through each byte of the hashed data
' and format each one as a hexadecimal string.
Dim i As Integer
For i = 0 To data.Length - 1
sBuilder.Append(data(i).ToString("x2"))
Next i
' Return the hexadecimal string.
Return sBuilder.ToString()
End Function
' Verify a hash against a string.
Protected Friend Shared Function verifyMd5Hash(ByVal input As String, ByVal hash As String) As Boolean
' Hash the input.
Dim hashOfInput As String = getMd5Hash(input)
' Create a StringComparer an compare the hashes.
Dim comparer As StringComparer = StringComparer.OrdinalIgnoreCase
If comparer.Compare(hashOfInput, hash) = 0 Then Return True
Return False
End Function
End Class
Using for password property to save:
Public ReadOnly Property Password() As String
Get
Return SecurePassword.GetMd5Hash(ConfirmPasswordBox.Text)
End Get
End Property
Check for password correction:
If SecurePassword.verifyMd5Hash(Me.PasswordBox.Text,
UserAccount(Me.ID).Password) = False Then
Me.PasswordBox.Text = ""
.SetError(Me.PasswordBox, "Wrong Password!")
Me.PasswordBox.Focus()
Me.PasswordBox.Select()
Exit Sub
End If
cryptography Article's
30 articles in total
How to truncate CBC ciphertext
read article
Bitflip Attack on CBC: Change of the Ciphertext
read article
Introducing Inline Cryptography Toolkit: Simplify Encryption, Decryption, and Hashing in VS Code ๐
read article
olssv dvysk!
read article
Bitflip Attack on CBC: Change of the IV
read article
Exploring Quantum Computing: The Next Frontier in Technology (2025)
read article
Como Habilitar o Provedor Legado no OpenSSL 3.x
read article
VB .Net: Secure Password
currently reading
C#: Secure Password
read article
Enhancing Data Security with MongoDB: A Dive into Cryptography and CSFLE at Ovianta
read article
What is Post-Quantum Cryptography (PQC) Migration and How to Secure Data Against Quantum Threats
read article
"Behind the Code: How Dark Web Drug Marketplaces Operate and the Developers Who Build Them"
read article
The Ultimate Guide to Choosing the Right Cryptography Algorithm for Your Project
read article
Lithe Crypt: Simplifying Encryption in PHP Applications
read article
Addressing The Threat of Deepfakes With Authentic Images
read article
Camouflage-Shield: An Image Encryption Application.
read article
Comparing Decentralized Identifiers(DID) Methods
read article
Decentralized Identity Simplified: How to Resolve DIDs Effectively
read article
Key Management for DIDs in Web5: A Beginnerโs Guide
read article
Key Management for DIDs: A Beginner's Journey
read article
Understanding Web5 and Its Potential
read article
Cryptography in Networking
read article
Medium article to explore Post Quantum Cryptography and algorithms comparison
read article
Day ??? of learning go. Building cli apps
read article
Building Secure and Scalable Blockchain Applications
read article
Introduction to Cryptography for Beginners
read article
GnuPG and Digital Signatures
read article
Cryptography Concepts Simplified
read article
The Hitchhikerโs Guide to Building an Encrypted Filesystem in Rust
read article
Cryptography #0 - Essential Concepts
read article
Featured ones: