Merge branch 'master' of github.com:alcexhim/MBS.Framework
This commit is contained in:
commit
87162aa9cb
@ -7,7 +7,7 @@
|
||||
<OutputType>Library</OutputType>
|
||||
<RootNamespace>MBS.Framework.Console</RootNamespace>
|
||||
<AssemblyName>MBS.Framework.CLI</AssemblyName>
|
||||
<ReleaseVersion>1.0.*</ReleaseVersion>
|
||||
<ReleaseVersion>4.0.2019.12</ReleaseVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
|
||||
@ -11,6 +11,7 @@
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<SignAssembly>true</SignAssembly>
|
||||
<AssemblyOriginatorKeyFile>..\..\MichaelBecker.snk</AssemblyOriginatorKeyFile>
|
||||
<ReleaseVersion>4.0.2019.12</ReleaseVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
@ -48,6 +49,7 @@
|
||||
<Compile Include="Drawing\Vector.cs" />
|
||||
<Compile Include="ArrayExtensions.cs" />
|
||||
<Compile Include="Reflection.cs" />
|
||||
<Compile Include="Security\Cryptography\ExtensionMethods.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
|
||||
@ -85,7 +85,11 @@ namespace MBS.Framework
|
||||
catch (ReflectionTypeLoadException ex)
|
||||
{
|
||||
Console.Error.WriteLine("ReflectionTypeLoadException(" + ex.LoaderExceptions.Length.ToString() + "): " + asm.FullName);
|
||||
Console.Error.WriteLine(ex.Message);
|
||||
for (int i = 0; i < ex.LoaderExceptions.Length; i++)
|
||||
{
|
||||
Console.Error.WriteLine("\t" + ex.LoaderExceptions[i].Message);
|
||||
Console.Error.WriteLine();
|
||||
}
|
||||
|
||||
types1 = ex.Types;
|
||||
}
|
||||
|
||||
27
MBS.Framework/Security/Cryptography/ExtensionMethods.cs
Normal file
27
MBS.Framework/Security/Cryptography/ExtensionMethods.cs
Normal file
@ -0,0 +1,27 @@
|
||||
using System.Security.Cryptography;
|
||||
|
||||
namespace MBS.Framework.Security.Cryptography
|
||||
{
|
||||
public static class ExtensionMethods
|
||||
{
|
||||
/// <summary>
|
||||
/// Computes the hash of the specified value in the given encoding.
|
||||
/// </summary>
|
||||
/// <returns>The hash.</returns>
|
||||
/// <param name="value">Value.</param>
|
||||
public static string ComputeHash(this HashAlgorithm ha, string value, System.Text.Encoding encoding = null)
|
||||
{
|
||||
if (encoding == null) encoding = System.Text.Encoding.UTF8;
|
||||
|
||||
byte[] buffer = encoding.GetBytes(value);
|
||||
|
||||
System.Text.StringBuilder sb = new System.Text.StringBuilder();
|
||||
byte[] output = ha.ComputeHash(buffer);
|
||||
for (int i = 0; i < output.Length; i++)
|
||||
{
|
||||
sb.Append(output[i].ToString("x").PadLeft(2, '0'));
|
||||
}
|
||||
return sb.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user