Questo sito utilizza cookies solo per scopi di autenticazione sul sito e nient'altro. Nessuna informazione personale viene tracciata. Leggi l'informativa sui cookies.
Username: Password: oppure
SHA1 Crypt - Form1.vb

Form1.vb

Caricato da:
Scarica il programma completo

  1. Imports System
  2. Imports System.Net
  3. Imports System.Text
  4. Imports System.Security
  5. Imports System.Security.Cryptography
  6. Public Class Form1
  7.     Inherits System.Windows.Forms.Form
  8.  
  9. #Region " Windows Form Designer generated code "
  10.  
  11.     Public Sub New()
  12.         MyBase.New()
  13.  
  14.         'This call is required by the Windows Form Designer.
  15.         InitializeComponent()
  16.  
  17.         'Add any initialization after the InitializeComponent() call
  18.  
  19.     End Sub
  20.  
  21.     'Form overrides dispose to clean up the component list.
  22.     Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
  23.         If disposing Then
  24.             If Not (components Is Nothing) Then
  25.                 components.Dispose()
  26.             End If
  27.         End If
  28.         MyBase.Dispose(disposing)
  29.     End Sub
  30.  
  31.     'Required by the Windows Form Designer
  32.     Private components As System.ComponentModel.IContainer
  33.  
  34.     'NOTE: The following procedure is required by the Windows Form Designer
  35.     'It can be modified using the Windows Form Designer.  
  36.     'Do not modify it using the code editor.
  37.     Friend WithEvents Label1 As System.Windows.Forms.Label
  38.     Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
  39.     Friend WithEvents Label2 As System.Windows.Forms.Label
  40.     Friend WithEvents TextBox2 As System.Windows.Forms.TextBox
  41.     Friend WithEvents Button1 As System.Windows.Forms.Button
  42.     Friend WithEvents Button2 As System.Windows.Forms.Button
  43.     <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
  44.         Me.Label1 = New System.Windows.Forms.Label
  45.         Me.TextBox1 = New System.Windows.Forms.TextBox
  46.         Me.Label2 = New System.Windows.Forms.Label
  47.         Me.TextBox2 = New System.Windows.Forms.TextBox
  48.         Me.Button1 = New System.Windows.Forms.Button
  49.         Me.Button2 = New System.Windows.Forms.Button
  50.         Me.SuspendLayout()
  51.         '
  52.         'Label1
  53.         '
  54.         Me.Label1.Location = New System.Drawing.Point(8, 8)
  55.         Me.Label1.Name = "Label1"
  56.         Me.Label1.Size = New System.Drawing.Size(144, 24)
  57.         Me.Label1.TabIndex = 0
  58.         Me.Label1.Text = "Text To Crypt:"
  59.         '
  60.         'TextBox1
  61.         '
  62.         Me.TextBox1.Location = New System.Drawing.Point(8, 32)
  63.         Me.TextBox1.Name = "TextBox1"
  64.         Me.TextBox1.Size = New System.Drawing.Size(256, 26)
  65.         Me.TextBox1.TabIndex = 1
  66.         Me.TextBox1.Text = "PieroTofy.it"
  67.         '
  68.         'Label2
  69.         '
  70.         Me.Label2.Location = New System.Drawing.Point(8, 72)
  71.         Me.Label2.Name = "Label2"
  72.         Me.Label2.Size = New System.Drawing.Size(168, 24)
  73.         Me.Label2.TabIndex = 2
  74.         Me.Label2.Text = "Text Crypted in SHA1:"
  75.         '
  76.         'TextBox2
  77.         '
  78.         Me.TextBox2.Location = New System.Drawing.Point(8, 96)
  79.         Me.TextBox2.Name = "TextBox2"
  80.         Me.TextBox2.Size = New System.Drawing.Size(256, 26)
  81.         Me.TextBox2.TabIndex = 3
  82.         Me.TextBox2.Text = ""
  83.         '
  84.         'Button1
  85.         '
  86.         Me.Button1.Location = New System.Drawing.Point(8, 128)
  87.         Me.Button1.Name = "Button1"
  88.         Me.Button1.Size = New System.Drawing.Size(120, 24)
  89.         Me.Button1.TabIndex = 4
  90.         Me.Button1.Text = "Crypt"
  91.         '
  92.         'Button2
  93.         '
  94.         Me.Button2.Location = New System.Drawing.Point(144, 128)
  95.         Me.Button2.Name = "Button2"
  96.         Me.Button2.Size = New System.Drawing.Size(120, 24)
  97.         Me.Button2.TabIndex = 5
  98.         Me.Button2.Text = "Copy"
  99.         '
  100.         'Form1
  101.         '
  102.         Me.AutoScaleBaseSize = New System.Drawing.Size(7, 19)
  103.         Me.ClientSize = New System.Drawing.Size(274, 160)
  104.         Me.Controls.Add(Me.Button2)
  105.         Me.Controls.Add(Me.Button1)
  106.         Me.Controls.Add(Me.TextBox2)
  107.         Me.Controls.Add(Me.Label2)
  108.         Me.Controls.Add(Me.TextBox1)
  109.         Me.Controls.Add(Me.Label1)
  110.         Me.Font = New System.Drawing.Font("Comic Sans MS", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
  111.         Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
  112.         Me.MaximizeBox = False
  113.         Me.MinimizeBox = False
  114.         Me.Name = "Form1"
  115.         Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
  116.         Me.Text = "SHA1 Crypt - By Citynova"
  117.         Me.ResumeLayout(False)
  118.  
  119.     End Sub
  120.  
  121. #End Region
  122.  
  123.     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  124.         TextBox2.Text = SHA1(TextBox1.Text)
  125.     End Sub
  126.     Public Function SHA1(ByVal Source) As String
  127.         Dim Bytes() As Byte = ASCIIEncoding.ASCII.GetBytes(Source)
  128.         Dim SHA1h As New SHA1CryptoServiceProvider
  129.         Dim Byt() As Byte = SHA1h.ComputeHash(Bytes)
  130.         Dim i As Integer = (Byt.Length * 2 + (Byt.Length / 8))
  131.         Dim StrBuild As StringBuilder = New StringBuilder(i)
  132.         Dim i2 As Integer
  133.         For i2 = 0 To Byt.Length - 1
  134.             StrBuild.Append(BitConverter.ToString(Byt, i2, 1))
  135.         Next i2
  136.         Return StrBuild.ToString().TrimEnd(New Char() {" "c}).ToLower
  137.     End Function
  138.  
  139.     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  140.         TextBox2.Text = SHA1(TextBox1.Text)
  141.     End Sub
  142.  
  143.     Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
  144.         Clipboard.SetDataObject(TextBox2.Text)
  145.     End Sub
  146. End Class