diff --git a/.github/workflows/pr-checks.yml b/.github/workflows/pr-checks.yml new file mode 100644 index 0000000..a530836 --- /dev/null +++ b/.github/workflows/pr-checks.yml @@ -0,0 +1,18 @@ +# Copyright (c) .NET Foundation and Contributors +# See LICENSE file in the project root for full license information. + +name: PR Checks + +on: + pull_request: + +jobs: + check_package_lock: + name: nanoFramework + uses: nanoframework/nf-tools/.github/workflows/check-package-lock.yml@main + check_nuget_latest: + name: nanoFramework + uses: nanoframework/nf-tools/.github/workflows/check-packages-updated.yml@main + secrets: inherit + with: + solution: 'nanoFramework.System.IO.Hashing.sln' diff --git a/.github/workflows/update-dependencies.yml b/.github/workflows/update-dependencies.yml new file mode 100644 index 0000000..a799a8f --- /dev/null +++ b/.github/workflows/update-dependencies.yml @@ -0,0 +1,21 @@ +# Copyright (c) .NET Foundation and Contributors +# See LICENSE file in the project root for full license information. + +# This workflow will periodically check .NET nanoFramework dependencies and updates them in the repository it's running. + +name: Daily update dependencies + +on: + schedule: + # At 00:10 UTC. + - cron: '00 10 * * Mon,Thu' + repository_dispatch: + types: update-dependencies + +jobs: + update-dependencies: + name: nanoFramework + uses: nanoframework/nf-tools/.github/workflows/update-dependencies.yml@main + secrets: inherit + with: + solutionsToCheck: 'nanoFramework.System.IO.Hashing.sln' diff --git a/.github_changelog_generator b/.github_changelog_generator new file mode 100644 index 0000000..f3844e6 --- /dev/null +++ b/.github_changelog_generator @@ -0,0 +1,13 @@ +user=nanoframework +project=nanoFramework.System.IO.Hashing +issues=true +add_issues_wo_labels=false +add_pr_wo_labels=false +add_issues_wo_labels=false +filter_issues_by_milestone=false +exclude_labels=Area: Config-and-Build,Area: Infrastructure-and-Organization,reverted +enhancement_labels=Type: enhancement +bug_labels=Type: bug +merge_prefix=**Documentation and other chores:** +unreleased_label=**Changes available only in 'Preview' NuGet packages:** +author=false diff --git a/.runsettings b/.runsettings new file mode 100644 index 0000000..75f9622 --- /dev/null +++ b/.runsettings @@ -0,0 +1,17 @@ + + + + + .\TestResults + 120000 + net48 + x64 + + + None + True + COM15 + + + + \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..e69de29 diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..94286c9 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) .NET Foundation and Contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/NuGet.Config b/NuGet.Config new file mode 100644 index 0000000..ef0bacf --- /dev/null +++ b/NuGet.Config @@ -0,0 +1,7 @@ + + + + + + + diff --git a/README.md b/README.md new file mode 100644 index 0000000..6435162 --- /dev/null +++ b/README.md @@ -0,0 +1,40 @@ +[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=nanoframework_System.IO.Hashing&metric=alert_status)](https://sonarcloud.io/dashboard?id=nanoframework_System.IO.Hashing) [![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=nanoframework_System.IO.Hashing&metric=reliability_rating)](https://sonarcloud.io/dashboard?id=nanoframework_System.IO.Hashing) [![NuGet](https://img.shields.io/nuget/dt/nanoFramework.System.IO.Hashing.svg?label=NuGet&style=flat&logo=nuget)](https://www.nuget.org/packages/nanoFramework.System.IO.Hashing/) [![#yourfirstpr](https://img.shields.io/badge/first--timers--only-friendly-blue.svg)](https://github.com/nanoframework/Home/blob/main/CONTRIBUTING.md) [![Discord](https://img.shields.io/discord/478725473862549535.svg?logo=discord&logoColor=white&label=Discord&color=7289DA)](https://discord.gg/gCyBu8T) + +![nanoFramework logo](https://raw.githubusercontent.com/nanoframework/Home/main/resources/logo/nanoFramework-repo-logo.png) + +----- + +### Welcome to the .NET **nanoFramework** System.IO.Hashing Library repository + +This repository contains the nanoFramework System.IO.Hashing class library. + +## Build status + +| Component | Build Status | NuGet Package | +|:-|---|---| +| System.IO.Hashing | [![Build Status](https://dev.azure.com/nanoframework/System.IO.Hashing/_apis/build/status%2Fnanoframework.System.IO.Hashing?branchName=main)](https://dev.azure.com/nanoframework/System.IO.Hashing/_build/latest?definitionId=102&branchName=main) | [![NuGet](https://img.shields.io/nuget/v/nanoFramework.System.IO.Hashing.svg?label=NuGet&style=flat&logo=nuget)](https://www.nuget.org/packages/nanoFramework.System.IO.Hashing/) | + +## System.IO.Hashing usage + +## Feedback and documentation + +For documentation, providing feedback, issues and finding out how to contribute please refer to the [Home repo](https://github.com/nanoframework/Home). + +Join our Discord community [here](https://discord.gg/gCyBu8T). + +## Credits + +The list of contributors to this project can be found at [CONTRIBUTORS](https://github.com/nanoframework/Home/blob/main/CONTRIBUTORS.md). + +## License + +The **nanoFramework** Class Libraries are licensed under the [MIT license](LICENSE.md). + +## Code of Conduct + +This project has adopted the code of conduct defined by the Contributor Covenant to clarify expected behaviour in our community. +For more information see the [.NET Foundation Code of Conduct](https://dotnetfoundation.org/code-of-conduct). + +### .NET Foundation + +This project is supported by the [.NET Foundation](https://dotnetfoundation.org). diff --git a/System.IO.Hashing/Crc32.cs b/System.IO.Hashing/Crc32.cs new file mode 100644 index 0000000..f1879a1 --- /dev/null +++ b/System.IO.Hashing/Crc32.cs @@ -0,0 +1,100 @@ +// +// Copyright (c) .NET Foundation and Contributors +// Portions Copyright (c) Microsoft Corporation. All rights reserved. +// See LICENSE file in the project root for full license information. +// + +using System.Runtime.CompilerServices; + +namespace System.IO.Hashing +{ + /// + /// Provides an implementation of the CRC-32 algorithm, as used in + /// ITU-T V.42 and IEEE 802.3. + /// + /// + /// + /// If the platform or target doesn't support Hardware Crc32 computation it will offer a software implementation. + /// + /// + /// For methods that return byte arrays or that write into spans of bytes, this implementation + /// emits the answer in the Little Endian byte order so that the CRC residue relationship + /// (CRC(message concat CRC(message))) is a fixed value) holds. + /// For CRC-32 this stable output is the byte sequence { 0x1C, 0xDF, 0x44, 0x21 }, + /// the Little Endian representation of 0x2144DF1C. + /// + /// + /// There are multiple, incompatible, definitions of a 32-bit cyclic redundancy + /// check (CRC) algorithm. When interoperating with another system, ensure that you + /// are using the same definition. The definition used by this implementation is not + /// compatible with the cyclic redundancy check described in ITU-T I.363.5. + /// + /// + public class Crc32 + { + private const uint InitialState = 0xFFFF_FFFF; + private uint _crc = InitialState; + + /// + /// Initializes a new instance of the class. + /// + public Crc32() + { + } + + /// + /// Appends the contents of to the data already processed for the current hash computation. + /// + /// The data to process. + public void Append(SpanByte source) + { + _crc = ComputeHash( + _crc, + source); + } + + /// + /// Appends the contents of to the data already processed for the current hash computation. + /// + /// The data to process. + public void Append(byte[] source) + { + _crc = ComputeHash( + _crc, + new SpanByte(source)); + } + + /// + /// Appends to the data already processed for the current hash computation. + /// + /// The to process. + public void Append(byte value) + { + _crc = ComputeHash( + _crc, + new byte[] { value }); + } + + /// + /// Resets the hash computation to the initial state. + /// + public void Reset() + { + _crc = InitialState; + } + + /// Gets the current computed hash value without modifying accumulated state. + /// The hash value for the data already provided. + public uint GetCurrentHashAsUInt32() => _crc ^ InitialState; + + /// Computes the CRC-32 hash of the provided data. + /// The data to hash. + /// The computed CRC-32 hash. + public static uint HashToUInt32(SpanByte source) => ComputeHash(InitialState, source) ^ InitialState; + + [MethodImpl(MethodImplOptions.InternalCall)] + extern private static uint ComputeHash( + uint crc, + SpanByte source); + } +} diff --git a/System.IO.Hashing/Properties/AssemblyInfo.cs b/System.IO.Hashing/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..175fbaa --- /dev/null +++ b/System.IO.Hashing/Properties/AssemblyInfo.cs @@ -0,0 +1,22 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("nanoFramework.System.IO.Hashing")] +[assembly: AssemblyCompany("nanoFramework Contributors")] +[assembly: AssemblyProduct("nanoFramework.System.IO.Hashing")] +[assembly: AssemblyCopyright("Copyright (c) .NET Foundation and Contributors")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +///////////////////////////////////////////////////////////////// +// This attribute is mandatory when building Interop libraries // +// update this whenever the native assembly signature changes // +[assembly: AssemblyNativeVersion("100.0.0.1")] +///////////////////////////////////////////////////////////////// diff --git a/System.IO.Hashing/System.IO.Hashing.nfproj b/System.IO.Hashing/System.IO.Hashing.nfproj new file mode 100644 index 0000000..0122bd4 --- /dev/null +++ b/System.IO.Hashing/System.IO.Hashing.nfproj @@ -0,0 +1,72 @@ + + + + + $(MSBuildExtensionsPath)\nanoFramework\v1.0\ + + + + Debug + AnyCPU + {11A8DD76-328B-46DF-9F39-F559912D0360};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + a05ef804-3fb8-42d1-8e0a-4d0002502755 + Library + Properties + 512 + System.IO.Hashing + nanoFramework.System.IO.Hashing + v1.0 + True + bin\$(Configuration)\nanoFramework.System.IO.Hashing.xml + true + true + + + true + + + ..\key.snk + + + false + + + + bin\$(Configuration)\Stubs + nf_sys_io_hashing + nanoFramework.System.IO.Hashing + + + + false + + + + + + + + + + ..\packages\nanoFramework.CoreLibrary.1.14.2\lib\mscorlib.dll + + + + + + + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105.The missing file is {0}. + + + + + + \ No newline at end of file diff --git a/System.IO.Hashing/packages.config b/System.IO.Hashing/packages.config new file mode 100644 index 0000000..75b7f06 --- /dev/null +++ b/System.IO.Hashing/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/System.IO.Hashing/packages.lock.json b/System.IO.Hashing/packages.lock.json new file mode 100644 index 0000000..b80edcb --- /dev/null +++ b/System.IO.Hashing/packages.lock.json @@ -0,0 +1,19 @@ +{ + "version": 1, + "dependencies": { + ".NETnanoFramework,Version=v1.0": { + "nanoFramework.CoreLibrary": { + "type": "Direct", + "requested": "[1.14.2, 1.14.2]", + "resolved": "1.14.2", + "contentHash": "j1mrz4mitl5LItvmHMsw1aHzCAfvTTgIkRxA0mhs5mSpctJ/BBcuNwua5j3MspfRNKreCQPy/qZy/D9ADLL/PA==" + }, + "Nerdbank.GitVersioning": { + "type": "Direct", + "requested": "[3.6.133, 3.6.133]", + "resolved": "3.6.133", + "contentHash": "VZWMd5YAeDxpjWjAP/X6bAxnRMiEf6tES/ITN0X5CHJgkWLLeHGmEALivmTAfYM6P+P/3Szy6VCITUAkqjcHVw==" + } + } + } +} \ No newline at end of file diff --git a/Tests/System.IO.HashingTests/Crc32Tests.cs b/Tests/System.IO.HashingTests/Crc32Tests.cs new file mode 100644 index 0000000..a711446 --- /dev/null +++ b/Tests/System.IO.HashingTests/Crc32Tests.cs @@ -0,0 +1,74 @@ +// +// Copyright (c) .NET Foundation and Contributors +// Portions Copyright (c) Microsoft Corporation. All rights reserved. +// See LICENSE file in the project root for full license information. +// + +using nanoFramework.TestFramework; +using System.Collections; +using System.IO.Hashing; +using System.Text; + +namespace Crc32Tests +{ + [TestClass] + public class Crc32Tests + { + static ArrayList _testData = new() + { + new byte[] { }, + new byte[] { 0x01 }, + new byte[] { 0x00, 0x00, 0x00, 0x00 }, + new byte[] { 0xFF, 0xFF, 0xFF, 0xFF }, + new byte[] { 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x26, 0x39, 0xF4, 0xCB }, + new byte[] { 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0xD9, 0xC6, 0x0B, 0x34 }, + Encoding.UTF8.GetBytes("a"), + Encoding.UTF8.GetBytes("abc"), + Encoding.UTF8.GetBytes("The quick brown fox jumps over the lazy dog") + }; + + [DataRow("Empty", 0, 0u)] + [DataRow("One", 1, 0xA505DF1Bu)] + [DataRow("Zero-Residue", 2, 0x2144DF1Cu)] + [DataRow("Zero-InverseResidue", 3, 0xFFFFFFFFu)] + [DataRow("Self-test residue", 4, 0x2144DF1Cu)] + [DataRow("Self-test inverse residue", 5, 0xFFFFFFFFu)] + [DataRow("String a", 6, 0xE8B7BE43u)] + [DataRow("String abc", 7, 0x352441C2u)] + [DataRow("String message digest", 8, 0x414FA339u)] + [TestMethod] + public void TestByteArrayHashing_00( + string testName, + int dataIndex, + uint hash) + { + OutputHelper.WriteLine($"Test: {testName}"); + + var crc32 = new Crc32(); + + crc32.Append((byte[])_testData[dataIndex]); + Assert.AreEqual(hash, crc32.GetCurrentHashAsUInt32()); + } + + [DataRow("Empty", 0, 0u)] + [DataRow("One", 1, 0xA505DF1Bu)] + [DataRow("Zero-Residue", 2, 0x2144DF1Cu)] + [DataRow("Zero-InverseResidue", 3, 0xFFFFFFFFu)] + [DataRow("Self-test residue", 4, 0x2144DF1Cu)] + [DataRow("Self-test inverse residue", 5, 0xFFFFFFFFu)] + [DataRow("String a", 6, 0xE8B7BE43u)] + [DataRow("String abc", 7, 0x352441C2u)] + [DataRow("String message digest", 8, 0x414FA339u)] + [TestMethod] + public void TestByteArrayHashing_01( + string testName, + int dataIndex, + uint hash) + { + OutputHelper.WriteLine($"Test: {testName}"); + + var computedHash = Crc32.HashToUInt32((byte[])_testData[dataIndex]); + Assert.AreEqual(hash, computedHash); + } + } +} diff --git a/Tests/System.IO.HashingTests/Properties/AssemblyInfo.cs b/Tests/System.IO.HashingTests/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..a3735af --- /dev/null +++ b/Tests/System.IO.HashingTests/Properties/AssemblyInfo.cs @@ -0,0 +1,31 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyCopyright("Copyright (c) 2021 nanoFramework contributors")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Tests/System.IO.HashingTests/System.IO.HashingTests.nfproj b/Tests/System.IO.HashingTests/System.IO.HashingTests.nfproj new file mode 100644 index 0000000..27ca2f4 --- /dev/null +++ b/Tests/System.IO.HashingTests/System.IO.HashingTests.nfproj @@ -0,0 +1,54 @@ + + + + $(MSBuildExtensionsPath)\nanoFramework\v1.0\ + + + + + + + Debug + AnyCPU + {11A8DD76-328B-46DF-9F39-F559912D0360};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 164e2d6c-8e81-47c7-93f2-98898e36b0cd + Library + Properties + 512 + Crc32Tests + NFUnitTest + False + true + UnitTest + v1.0 + + + + $(SolutionDir)\.runsettings + + + + + + + + ..\..\packages\nanoFramework.CoreLibrary.1.14.2\lib\mscorlib.dll + + + ..\..\packages\nanoFramework.System.Text.1.2.37\lib\nanoFramework.System.Text.dll + + + ..\..\packages\nanoFramework.TestFramework.2.1.85\lib\nanoFramework.TestFramework.dll + + + ..\..\packages\nanoFramework.TestFramework.2.1.85\lib\nanoFramework.UnitTestLauncher.exe + + + + + + + + + + \ No newline at end of file diff --git a/Tests/System.IO.HashingTests/packages.config b/Tests/System.IO.HashingTests/packages.config new file mode 100644 index 0000000..f45895e --- /dev/null +++ b/Tests/System.IO.HashingTests/packages.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Tests/System.IO.HashingTests/packages.lock.json b/Tests/System.IO.HashingTests/packages.lock.json new file mode 100644 index 0000000..d5213a1 --- /dev/null +++ b/Tests/System.IO.HashingTests/packages.lock.json @@ -0,0 +1,25 @@ +{ + "version": 1, + "dependencies": { + ".NETnanoFramework,Version=v1.0": { + "nanoFramework.CoreLibrary": { + "type": "Direct", + "requested": "[1.14.2, 1.14.2]", + "resolved": "1.14.2", + "contentHash": "j1mrz4mitl5LItvmHMsw1aHzCAfvTTgIkRxA0mhs5mSpctJ/BBcuNwua5j3MspfRNKreCQPy/qZy/D9ADLL/PA==" + }, + "nanoFramework.System.Text": { + "type": "Direct", + "requested": "[1.2.37, 1.2.37]", + "resolved": "1.2.37", + "contentHash": "ORgRq0HSynSBhlXRTHdhzZiOdq/nRhdnX+DeIGw56y9OSc8dvqUz6elm97Jz+4WQ6ikpvs5PFGINAa35kBebwQ==" + }, + "nanoFramework.TestFramework": { + "type": "Direct", + "requested": "[2.1.85, 2.1.85]", + "resolved": "2.1.85", + "contentHash": "UAydT9MgZfufPcLpn5KbFZkR3ul6zSt9ERYDPDen7IWxeT+fGpRTes8QTWfhgMsxF3E27b3wI6K6wwWQkeGuFQ==" + } + } + } +} \ No newline at end of file diff --git a/assets/nf-logo.png b/assets/nf-logo.png new file mode 100644 index 0000000..572c4ff Binary files /dev/null and b/assets/nf-logo.png differ diff --git a/assets/readme.txt b/assets/readme.txt new file mode 100644 index 0000000..8449286 --- /dev/null +++ b/assets/readme.txt @@ -0,0 +1,21 @@ + _____ _ + _ __ __ _ _ __ ___ | ___| __ __ _ _ __ ___ _____ _____ _ __| | __ + | '_ \ / _` | '_ \ / _ \| |_ | '__/ _` | '_ ` _ \ / _ \ \ /\ / / _ \| '__| |/ / + | | | | (_| | | | | (_) | _|| | | (_| | | | | | | __/\ V V / (_) | | | < + |_| |_|\__,_|_| |_|\___/|_| |_| \__,_|_| |_| |_|\___| \_/\_/ \___/|_| |_|\_\ + +=================================================================================== + +API docs: https://docs.nanoframework.net/api/nanoFramework.System.IO.Hashing.html + +Browse our samples repository: https://github.com/nanoframework/samples + +Check our documentation online: https://docs.nanoframework.net/ + +Join our lively Discord community: https://discord.gg/gCyBu8T + +Report issues: https://github.com/nanoframework/Home/issues + +Follow us on Twitter: https://twitter.com/nanoframework + +Follow our YouTube channel: https://www.youtube.com/c/nanoFramework diff --git a/azure-pipelines.yml b/azure-pipelines.yml index f53e97b..1eab7e0 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -1,19 +1,59 @@ -# Starter pipeline -# Start with a minimal pipeline that you can customize to build and deploy your code. -# Add steps that build, run tests, deploy, and more: -# https://aka.ms/yaml +# Copyright (c) .NET Foundation and Contributors +# See LICENSE file in the project root for full license information. trigger: -- main + branches: + include: + - main + - release-* + paths: + exclude: + - .github_changelog_generator + - .gitignore + - CHANGELOG.md + - LICENSE.md + - README.md + - NuGet.Config + - assets/* + - config/* + - .github/* + +# PR always trigger build +pr: + autoCancel: true + +# add nf-tools repo to resources (for Azure Pipelines templates) +resources: + repositories: + - repository: templates + type: github + name: nanoframework/nf-tools + endpoint: nanoframework pool: - vmImage: ubuntu-latest + vmImage: 'windows-latest' + +variables: + DOTNET_NOLOGO: true + solution: 'nanoFramework.System.IO.Hashing.sln' + buildPlatform: 'Any CPU' + buildConfiguration: 'Release' + nugetPackageName: 'nanoFramework.System.IO.Hashing' steps: -- script: echo Hello, world! - displayName: 'Run a one-line script' -- script: | - echo Add other tasks to build, test, and deploy your project. - echo See https://aka.ms/yaml - displayName: 'Run a multi-line script' +# step from template @ nf-tools repo +# all build, update and publish steps +- template: azure-pipelines-templates/class-lib-build.yml@templates + parameters: + sonarCloudProject: 'nanoframework_System.IO.Hashing' + runUnitTests: false + unitTestRunsettings: '$(System.DefaultWorkingDirectory)\.runsettings' + +# step from template @ nf-tools repo +# report error +- template: azure-pipelines-templates/discord-webhook-task.yml@templates + parameters: + status: 'failure' + webhookUrl: '$(DiscordWebhook)' + message: '' diff --git a/config/SignClient.json b/config/SignClient.json new file mode 100644 index 0000000..482177d --- /dev/null +++ b/config/SignClient.json @@ -0,0 +1,14 @@ +{ + "SignClient": { + "AzureAd": { + "AADInstance": "https://login.microsoftonline.com/", + "ClientId": "c248d68a-ba6f-4aa9-8a68-71fe872063f8", + "TenantId": "16076fdc-fcc1-4a15-b1ca-32c9a255900e" + }, + "Service": { + "Url": "https://codesign.dotnetfoundation.org/", + "ResourceId": "https://SignService/3c30251f-36f3-490b-a955-520addb85001" + } + } + } + \ No newline at end of file diff --git a/config/filelist.txt b/config/filelist.txt new file mode 100644 index 0000000..786fca4 --- /dev/null +++ b/config/filelist.txt @@ -0,0 +1 @@ +**/nanoFramework.System.IO.Hashing.* \ No newline at end of file diff --git a/key.snk b/key.snk new file mode 100644 index 0000000..67c9bb0 Binary files /dev/null and b/key.snk differ diff --git a/nanoFramework.System.IO.Hashing.nuspec b/nanoFramework.System.IO.Hashing.nuspec new file mode 100644 index 0000000..ddf4fa3 --- /dev/null +++ b/nanoFramework.System.IO.Hashing.nuspec @@ -0,0 +1,37 @@ + + + + nanoFramework.System.IO.Hashing + $version$ + nanoFramework.System.IO.Hashing + nanoframework + false + LICENSE.md + + + docs\README.md + false + https://github.com/nanoframework/System.IO.Hashing + images\nf-logo.png + + Copyright (c) .NET Foundation and Contributors + This package includes the nanoFramework System.IO.Hashing assembly for .NET nanoFramework C# projects. +This package requires a target with nanoFramework.System.IO.Hashing v$nativeVersion$ (checksum $checksum$). + nanoFramework C# csharp netmf netnf + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/nanoFramework.System.IO.Hashing.sln b/nanoFramework.System.IO.Hashing.sln new file mode 100644 index 0000000..6152426 --- /dev/null +++ b/nanoFramework.System.IO.Hashing.sln @@ -0,0 +1,47 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.7.34024.191 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{7B20F2BC-2DD3-42C3-AE9B-01F5F558ADFE}" +EndProject +Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "System.IO.HashingTests", "Tests\System.IO.HashingTests\System.IO.HashingTests.nfproj", "{164E2D6C-8E81-47C7-93F2-98898E36B0CD}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{49C02042-2EA7-4EC8-B341-473EC5CBE2BE}" + ProjectSection(SolutionItems) = preProject + .runsettings = .runsettings + NuGet.Config = NuGet.Config + version.json = version.json + EndProjectSection +EndProject +Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "System.IO.Hashing", "System.IO.Hashing\System.IO.Hashing.nfproj", "{A05EF804-3FB8-42D1-8E0A-4D0002502755}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {164E2D6C-8E81-47C7-93F2-98898E36B0CD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {164E2D6C-8E81-47C7-93F2-98898E36B0CD}.Debug|Any CPU.Build.0 = Debug|Any CPU + {164E2D6C-8E81-47C7-93F2-98898E36B0CD}.Debug|Any CPU.Deploy.0 = Debug|Any CPU + {164E2D6C-8E81-47C7-93F2-98898E36B0CD}.Release|Any CPU.ActiveCfg = Release|Any CPU + {164E2D6C-8E81-47C7-93F2-98898E36B0CD}.Release|Any CPU.Build.0 = Release|Any CPU + {164E2D6C-8E81-47C7-93F2-98898E36B0CD}.Release|Any CPU.Deploy.0 = Release|Any CPU + {A05EF804-3FB8-42D1-8E0A-4D0002502755}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A05EF804-3FB8-42D1-8E0A-4D0002502755}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A05EF804-3FB8-42D1-8E0A-4D0002502755}.Debug|Any CPU.Deploy.0 = Debug|Any CPU + {A05EF804-3FB8-42D1-8E0A-4D0002502755}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A05EF804-3FB8-42D1-8E0A-4D0002502755}.Release|Any CPU.Build.0 = Release|Any CPU + {A05EF804-3FB8-42D1-8E0A-4D0002502755}.Release|Any CPU.Deploy.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {164E2D6C-8E81-47C7-93F2-98898E36B0CD} = {7B20F2BC-2DD3-42C3-AE9B-01F5F558ADFE} + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {FBF8F1F8-8AB4-4305-8E5D-E8E20849D22B} + EndGlobalSection +EndGlobal diff --git a/version.json b/version.json new file mode 100644 index 0000000..fdf769d --- /dev/null +++ b/version.json @@ -0,0 +1,24 @@ +{ + "$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json", + "version": "1.0", + "assemblyVersion": { + "precision": "build" + }, + "semVer1NumericIdentifierPadding": 3, + "nuGetPackageVersion": { + "semVer": 2.0 + }, + "publicReleaseRefSpec": [ + "^refs/heads/develop$", + "^refs/heads/main$", + "^refs/heads/v\\d+(?:\\.\\d+)?$" + ], + "cloudBuild": { + "setAllVariables": true + }, + "release": { + "branchName": "release-v{version}", + "versionIncrement": "build", + "firstUnstableTag": "preview" + } +}