diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..412eeda --- /dev/null +++ b/.gitattributes @@ -0,0 +1,22 @@ +# Auto detect text files and perform LF normalization +* text=auto + +# Custom for Visual Studio +*.cs diff=csharp +*.sln merge=union +*.csproj merge=union +*.vbproj merge=union +*.fsproj merge=union +*.dbproj merge=union + +# Standard to msysgit +*.doc diff=astextplain +*.DOC diff=astextplain +*.docx diff=astextplain +*.DOCX diff=astextplain +*.dot diff=astextplain +*.DOT diff=astextplain +*.pdf diff=astextplain +*.PDF diff=astextplain +*.rtf diff=astextplain +*.RTF diff=astextplain diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2f311de --- /dev/null +++ b/.gitignore @@ -0,0 +1,212 @@ +################# +## Eclipse +################# + +*.pydevproject +.project +.metadata +tmp/ +*.tmp +*.bak +*.swp +*~.nib +local.properties +.classpath +.settings/ +.loadpath + +# External tool builders +.externalToolBuilders/ + +# Locally stored "Eclipse launch configurations" +*.launch + +# CDT-specific +.cproject + +# PDT-specific +.buildpath + + +################# +## Visual Studio +################# + +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. + +# User-specific files +*.suo +*.user +*.sln.docstates + +# Build results + +[Dd]ebug/ +x64/ +build/ +[Oo]bj/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +*_i.c +*_p.c +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.log +*.scc + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opensdf +*.sdf +*.cachefile + +# Visual Studio profiler +*.psess +*.vsp +*.vspx + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# NCrunch +*.ncrunch* +.*crunch*.local.xml + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.Publish.xml +*.pubxml + +# NuGet Packages Directory +## TODO: If you have NuGet Package Restore enabled, uncomment the next line +#packages/ + +# Windows Azure Build Output +csx +*.build.csdef + +# Windows Store app package directory +AppPackages/ + +# Others +sql/ +*.Cache +ClientBin/ +[Ss]tyle[Cc]op.* +~$* +*~ +*.dbmdl +*.[Pp]ublish.xml +*.pfx +*.publishsettings + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file to a newer +# Visual Studio version. Backup files are not needed, because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm + +# SQL Server files +App_Data/*.mdf +App_Data/*.ldf + +############# +## Windows detritus +############# + +# Windows image file caches +Thumbs.db +ehthumbs.db + +# Folder config file +Desktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Mac crap +.DS_Store + + +############# +## Python +############# + +*.py[co] + +# Packages +*.egg +*.egg-info +dist/ +build/ +eggs/ +parts/ +var/ +sdist/ +develop-eggs/ +.installed.cfg + +# Installer logs +pip-log.txt + +# Unit test / coverage reports +.coverage +.tox + +#Translations +*.mo + +#Mr Developer +.mr.developer.cfg diff --git a/README b/README new file mode 100644 index 0000000..0b803f7 --- /dev/null +++ b/README @@ -0,0 +1 @@ +reference: http://msdn.microsoft.com/en-us/library/system.security.cryptography.md5(v=vs.110).aspx \ No newline at end of file diff --git a/Text2MD5.sln b/Text2MD5.sln new file mode 100644 index 0000000..b2bfea6 --- /dev/null +++ b/Text2MD5.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Express 2012 for Windows Desktop +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Text2MD5", "Text2MD5\Text2MD5.vbproj", "{C1BDE4AA-7098-4B53-9C54-53A1E2193747}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {C1BDE4AA-7098-4B53-9C54-53A1E2193747}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C1BDE4AA-7098-4B53-9C54-53A1E2193747}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C1BDE4AA-7098-4B53-9C54-53A1E2193747}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C1BDE4AA-7098-4B53-9C54-53A1E2193747}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Text2MD5/App.config b/Text2MD5/App.config new file mode 100644 index 0000000..d3d2996 --- /dev/null +++ b/Text2MD5/App.config @@ -0,0 +1,6 @@ + + + + + + diff --git a/Text2MD5/Form1.Designer.vb b/Text2MD5/Form1.Designer.vb new file mode 100644 index 0000000..a8b45a4 --- /dev/null +++ b/Text2MD5/Form1.Designer.vb @@ -0,0 +1,62 @@ + _ +Partial Class Form1 + Inherits System.Windows.Forms.Form + + 'Form 重写 Dispose,以清理组件列表。 + _ + Protected Overrides Sub Dispose(ByVal disposing As Boolean) + Try + If disposing AndAlso components IsNot Nothing Then + components.Dispose() + End If + Finally + MyBase.Dispose(disposing) + End Try + End Sub + + 'Windows 窗体设计器所必需的 + Private components As System.ComponentModel.IContainer + + '注意: 以下过程是 Windows 窗体设计器所必需的 + '可以使用 Windows 窗体设计器修改它。 + '不要使用代码编辑器修改它。 + _ + Private Sub InitializeComponent() + Me.TextBox1 = New System.Windows.Forms.TextBox() + Me.Button1 = New System.Windows.Forms.Button() + Me.SuspendLayout() + ' + 'TextBox1 + ' + Me.TextBox1.Location = New System.Drawing.Point(12, 12) + Me.TextBox1.Multiline = True + Me.TextBox1.Name = "TextBox1" + Me.TextBox1.Size = New System.Drawing.Size(600, 388) + Me.TextBox1.TabIndex = 0 + ' + 'Button1 + ' + Me.Button1.Location = New System.Drawing.Point(537, 409) + Me.Button1.Name = "Button1" + Me.Button1.Size = New System.Drawing.Size(75, 23) + Me.Button1.TabIndex = 1 + Me.Button1.Text = "MD5" + Me.Button1.UseVisualStyleBackColor = True + ' + 'Form1 + ' + Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 12.0!) + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.ClientSize = New System.Drawing.Size(624, 444) + Me.Controls.Add(Me.Button1) + Me.Controls.Add(Me.TextBox1) + Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow + Me.Name = "Form1" + Me.Text = "Text2MD5" + Me.ResumeLayout(False) + Me.PerformLayout() + + End Sub + Friend WithEvents TextBox1 As System.Windows.Forms.TextBox + Friend WithEvents Button1 As System.Windows.Forms.Button +End Class diff --git a/Text2MD5/Form1.resx b/Text2MD5/Form1.resx new file mode 100644 index 0000000..7080a7d --- /dev/null +++ b/Text2MD5/Form1.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Text2MD5/Form1.vb b/Text2MD5/Form1.vb new file mode 100644 index 0000000..503f699 --- /dev/null +++ b/Text2MD5/Form1.vb @@ -0,0 +1,70 @@ +Imports System +Imports System.Security.Cryptography +Imports System.Text + +Module Example + + Dim DATA_SIZE As Object + + + + ' Hash an input string and return the hash as + ' a 32 character hexadecimal string. + 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. + 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 comare the hashes. + Dim comparer As StringComparer = StringComparer.OrdinalIgnoreCase + + If 0 = comparer.Compare(hashOfInput, hash) Then + Return True + Else + Return False + End If + + End Function + +End Module +Public Class Form1 + + Dim DATA_SIZE As Object + + Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click + Dim source As String = TextBox1.Text + Dim hash As String = getMd5Hash(source) + TextBox1.Text = hash + + End Sub + + + Private Function SHA1CryptoServiceProvider(p1 As String) As String + Throw New NotImplementedException + End Function + +End Class \ No newline at end of file diff --git a/Text2MD5/Text2MD5.vbproj b/Text2MD5/Text2MD5.vbproj new file mode 100644 index 0000000..441ee10 --- /dev/null +++ b/Text2MD5/Text2MD5.vbproj @@ -0,0 +1,90 @@ + + + + + Debug + AnyCPU + {C1BDE4AA-7098-4B53-9C54-53A1E2193747} + WinExe + Text2MD5 + Text2MD5 + 512 + Empty + v2.0 + 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 + + + + AnyCPU + true + full + true + true + bin\Debug\ + + + 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 + + + AnyCPU + pdbonly + false + true + true + bin\Release\ + + + 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 + + + On + + + Binary + + + Off + + + On + + + Text2MD5.Form1 + + + + + + + + + + + + + + Form1.vb + + + Form + + + + + + + + + + Form1.vb + + + + + \ No newline at end of file diff --git a/Text2MD5/bin/Release/Text2MD5.exe b/Text2MD5/bin/Release/Text2MD5.exe new file mode 100644 index 0000000..2968c88 Binary files /dev/null and b/Text2MD5/bin/Release/Text2MD5.exe differ diff --git a/Text2MD5/bin/Release/Text2MD5.exe.config b/Text2MD5/bin/Release/Text2MD5.exe.config new file mode 100644 index 0000000..d3d2996 --- /dev/null +++ b/Text2MD5/bin/Release/Text2MD5.exe.config @@ -0,0 +1,6 @@ + + + + + + diff --git a/Text2MD5/bin/Release/Text2MD5.vshost.exe b/Text2MD5/bin/Release/Text2MD5.vshost.exe new file mode 100644 index 0000000..b6ed6ae Binary files /dev/null and b/Text2MD5/bin/Release/Text2MD5.vshost.exe differ diff --git a/Text2MD5/bin/Release/Text2MD5.vshost.exe.config b/Text2MD5/bin/Release/Text2MD5.vshost.exe.config new file mode 100644 index 0000000..d3d2996 --- /dev/null +++ b/Text2MD5/bin/Release/Text2MD5.vshost.exe.config @@ -0,0 +1,6 @@ + + + + + + diff --git a/Text2MD5/bin/Release/Text2MD5.vshost.exe.manifest b/Text2MD5/bin/Release/Text2MD5.vshost.exe.manifest new file mode 100644 index 0000000..061c9ca --- /dev/null +++ b/Text2MD5/bin/Release/Text2MD5.vshost.exe.manifest @@ -0,0 +1,11 @@ + + + + + + + + + + +