Добавьте файлы проекта.
This commit is contained in:
42
Base64encoder.sln
Normal file
42
Base64encoder.sln
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio Version 17
|
||||||
|
VisualStudioVersion = 17.0.32126.317
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Base64encoder", "Base64encoder\Base64encoder.csproj", "{CA02C7C7-9449-4F15-A6C8-886918B02356}"
|
||||||
|
EndProject
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Base64encoderTests", "Base64encoderTests\Base64encoderTests.csproj", "{A95BADAC-7AC8-4D7A-ACA8-6ABE9BAEA94E}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Debug|x64 = Debug|x64
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
Release|x64 = Release|x64
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{CA02C7C7-9449-4F15-A6C8-886918B02356}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{CA02C7C7-9449-4F15-A6C8-886918B02356}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{CA02C7C7-9449-4F15-A6C8-886918B02356}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{CA02C7C7-9449-4F15-A6C8-886918B02356}.Debug|x64.Build.0 = Debug|x64
|
||||||
|
{CA02C7C7-9449-4F15-A6C8-886918B02356}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{CA02C7C7-9449-4F15-A6C8-886918B02356}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{CA02C7C7-9449-4F15-A6C8-886918B02356}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{CA02C7C7-9449-4F15-A6C8-886918B02356}.Release|x64.Build.0 = Release|x64
|
||||||
|
{A95BADAC-7AC8-4D7A-ACA8-6ABE9BAEA94E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{A95BADAC-7AC8-4D7A-ACA8-6ABE9BAEA94E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{A95BADAC-7AC8-4D7A-ACA8-6ABE9BAEA94E}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||||
|
{A95BADAC-7AC8-4D7A-ACA8-6ABE9BAEA94E}.Debug|x64.Build.0 = Debug|Any CPU
|
||||||
|
{A95BADAC-7AC8-4D7A-ACA8-6ABE9BAEA94E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{A95BADAC-7AC8-4D7A-ACA8-6ABE9BAEA94E}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{A95BADAC-7AC8-4D7A-ACA8-6ABE9BAEA94E}.Release|x64.ActiveCfg = Release|Any CPU
|
||||||
|
{A95BADAC-7AC8-4D7A-ACA8-6ABE9BAEA94E}.Release|x64.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
VisualSVNWorkingCopyRoot = .
|
||||||
|
SolutionGuid = {12CCE259-8107-43EB-8F2E-526B3D47F8A4}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
||||||
18
Base64encoder/Base64encoder.csproj
Normal file
18
Base64encoder/Base64encoder.csproj
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net5.0</TargetFramework>
|
||||||
|
<RootNamespace>Ru.Pfr.Crypto.Base64encoder</RootNamespace>
|
||||||
|
<Platforms>AnyCPU;x64</Platforms>
|
||||||
|
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||||
|
<PlatformTarget>x64</PlatformTarget>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<PlatformTarget>x64</PlatformTarget>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
27
Base64encoder/Encoder64.cs
Normal file
27
Base64encoder/Encoder64.cs
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
using System;
|
||||||
|
using System.Security.Cryptography;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Ru.Pfr.Crypto.Base64encoder
|
||||||
|
{
|
||||||
|
public static class Encoder64
|
||||||
|
{
|
||||||
|
public static String EncodeTo64(String _string)
|
||||||
|
{
|
||||||
|
string result;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
SHA1Managed hasher = new();
|
||||||
|
byte[] pwdBytes = Encoding.Default.GetBytes(_string);
|
||||||
|
byte[] keyBytes = hasher.ComputeHash(pwdBytes);
|
||||||
|
hasher.Dispose();
|
||||||
|
result = Convert.ToBase64String(keyBytes);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Exception(ex.Message, ex);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
24
Base64encoderTests/Base64encoderTests.csproj
Normal file
24
Base64encoderTests/Base64encoderTests.csproj
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>.NETCoreApp,Version=v5.0</TargetFramework>
|
||||||
|
|
||||||
|
<IsPackable>false</IsPackable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||||
|
<PlatformTarget>x64</PlatformTarget>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0" />
|
||||||
|
<PackageReference Include="MSTest.TestAdapter" Version="2.2.7" />
|
||||||
|
<PackageReference Include="MSTest.TestFramework" Version="2.2.7" />
|
||||||
|
<PackageReference Include="coverlet.collector" Version="3.1.0" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\Base64encoder\Base64encoder.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
22
Base64encoderTests/Encoder64Tests.cs
Normal file
22
Base64encoderTests/Encoder64Tests.cs
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||||
|
using Ru.Pfr.Crypto.Base64encoder;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Ru.Pfr.Crypto.Base64encoder.Tests
|
||||||
|
{
|
||||||
|
[TestClass()]
|
||||||
|
public class Encoder64Tests
|
||||||
|
{
|
||||||
|
[TestMethod()]
|
||||||
|
public void EncodeTo64Test()
|
||||||
|
{
|
||||||
|
String result = Encoder64.EncodeTo64("MyPassword");
|
||||||
|
Console.WriteLine(result);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user