Files
ClosedXML/ClosedXML_Tests/Excel/Protection/HashAlgorithmTests.cs
T
Thom Lamb 2cd6df6481 Initial commit of the ClosedXML library
Establishes the foundational structure, core Excel functionality, and tooling.

- Implements base components for cells, ranges, columns, and rows.
- Integrates a custom calculation engine with a wide range of Excel functions.
- Adds comprehensive support for styling, conditional formatting, data validation, comments, pictures, and charts.
- Configures build setup, project metadata (NuGet), and developer guidelines.
- Includes editor and Git attributes for consistent code style and line endings.
2026-06-23 11:02:53 -05:00

31 lines
1008 B
C#

using ClosedXML.Utils;
using NUnit.Framework;
using static ClosedXML.Excel.XLProtectionAlgorithm;
namespace ClosedXML_Tests.Excel.Protection
{
public class HashAlgorithmTests
{
[Test]
public void TestEmptyPassword()
{
Assert.IsEmpty(CryptographicAlgorithms.GetPasswordHash(Algorithm.SHA512, string.Empty));
Assert.IsEmpty(CryptographicAlgorithms.GetPasswordHash(Algorithm.SimpleHash, string.Empty));
}
[Test]
public void TestSHA512()
{
var hash = CryptographicAlgorithms.GetPasswordHash(Algorithm.SHA512, "12345", "aVvPw1DNH3evPqRAd/y3UQ==", 100000);
Assert.AreEqual("E+qAhyIg/HM0dUrPaENfimFOZp7wlOkJsf/sdG+AGHOA9grOv7VLb1ik2vuYohljI9G36e0ea9wnixCK0MMuyQ==", hash);
}
[Test]
public void TestSimple()
{
var hash = CryptographicAlgorithms.GetPasswordHash(Algorithm.SimpleHash, "12345");
Assert.AreEqual("CA9C", hash);
}
}
}