How to create SHA1 Encryption program
How do I go about creating a windows application that converts strings to sha1 encrypted? All I want this program to do is have a user type in their password, click a command button "Convert" and have a label come up with the now SHA1 encrypted string. NOTE: THis is just for my own personal use, I will be in no way distributing or selling this program.
Slade
Practically a Master Poster
633 posts since Mar 2004
Reputation Points: 115
Solved Threads: 7
Slade
Practically a Master Poster
633 posts since Mar 2004
Reputation Points: 115
Solved Threads: 7
it's ok, my supervisor is teaching me how to use crypto stuff. I will tell you more later.
Slade
Practically a Master Poster
633 posts since Mar 2004
Reputation Points: 115
Solved Threads: 7
Thanks! My hardware should be arriving this week which means an article on forms authentication is due.
Slade
Practically a Master Poster
633 posts since Mar 2004
Reputation Points: 115
Solved Threads: 7
I can't understand why my code wont work. Check it out.
Imports SHA1_Encryption
Imports System.Security.Cryptography
PublicClass Form1
Inherits System.Windows.Forms.Form
(Windows for designer generated code)
PublicFunction ComputeHashValue(ByVal data() AsByte) AsByte()
Dim hashAlg As SHA1 = SHA1.Create()
Dim hashvalue() AsByte = hashAlg.ComputeHash(data)
Return hashvalue
EndFunction
PrivateSub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim test AsByte()
test = ComputeHashValue(Encoding.ASCII.Text(TextBox1.Text))
EndSub
EndClass
The encoding part wont work and when I hover over it it says. "Name 'Encoding' is not declared." any ideas? Maybe I'm missing a library reference?
Slade
Practically a Master Poster
633 posts since Mar 2004
Reputation Points: 115
Solved Threads: 7
OK I would still like to get the windows encryption working (above) but I have finished a web application one for now:
Imports System.Web.Security
PrivateSub btnProcess_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnProcess.Click
Dim encpass AsString = FormsAuthentication.HashPasswordForStoringInConfigFile(txtPassword.Text, "sha1")
lblResult.Text = encpass.ToString()
EndSub
Slade
Practically a Master Poster
633 posts since Mar 2004
Reputation Points: 115
Solved Threads: 7
lol well I copied and pasted it from vs .net, but I've done it before using this rich text editor :D
Slade
Practically a Master Poster
633 posts since Mar 2004
Reputation Points: 115
Solved Threads: 7