Anonymiser 1.0.2505.1209

dotnet add package Anonymiser --version 1.0.2505.1209
                    
NuGet\Install-Package Anonymiser -Version 1.0.2505.1209
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Anonymiser" Version="1.0.2505.1209" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Anonymiser" Version="1.0.2505.1209" />
                    
Directory.Packages.props
<PackageReference Include="Anonymiser" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Anonymiser --version 1.0.2505.1209
                    
#r "nuget: Anonymiser, 1.0.2505.1209"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Anonymiser@1.0.2505.1209
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Anonymiser&version=1.0.2505.1209
                    
Install as a Cake Addin
#tool nuget:?package=Anonymiser&version=1.0.2505.1209
                    
Install as a Cake Tool

Anonymiser

A .NET library for anonymizing sensitive data in JSON, XML, and CSV documents while maintaining consistency across multiple files.

Features

  • Anonymize sensitive data in JSON, XML, and CSV documents
  • Maintain consistent anonymization for specified fields across multiple files
  • Configurable anonymization rules
  • Support for different anonymization strategies
  • Asynchronous processing

Installation

dotnet add package Anonymiser

Usage

Basic Usage

using Anonymiser;
using Anonymiser.Models.Configuration;

// Initialize with configuration file
var anonymiser = new Anonymiser("config.json");

// Or initialize with configuration object
var config = new AnonymisationConfig
{
    AnonymiseSeed = "your-seed",
    PropertiesToAnonymise = new List<PropertyToAnonymise>
    {
        new PropertyToAnonymise 
        { 
            PropertyName = "Email", 
            AnonymisationType = "mask", 
            IsConsistent = true 
        }
    }
};
var anonymiser = new Anonymiser(config);

// Anonymize JSON
var anonymisedJson = await anonymiser.AnonymiseJsonAsync(jsonContent);

// Anonymize XML
var anonymisedXml = await anonymiser.AnonymiseXmlAsync(xmlContent);

// Anonymize CSV
var anonymisedCsv = await anonymiser.AnonymiseCsvAsync(csvContent);

Configuration

The configuration file (config.json) should follow this structure:

{
    "AnonymiseSeed": "your-seed",
    "PropertiesToAnonymise": [
        {
            "PropertyName": "Email",
            "AnonymisationType": "mask",
            "IsConsistent": true
        },
        {
            "PropertyName": "Name",
            "AnonymisationType": "mask",
            "IsConsistent": true
        }
    ]
}
  • AnonymiseSeed: A string used to seed the anonymization process for consistent results
  • PropertiesToAnonymise: List of properties to anonymize
    • PropertyName: The name of the property to anonymize
    • AnonymisationType: The type of anonymization to apply (currently only "mask" is supported)
    • IsConsistent: Whether the same input should always produce the same anonymized output

Consistent Anonymization

When IsConsistent is set to true for a property, the same input value will always produce the same anonymized output, even across different files. This is useful for maintaining referential integrity in your data.

Examples

JSON Anonymization

Input:

{
    "Name": "John Doe",
    "Email": "john.doe@example.com",
    "customerName": "Jane Smith",
    "customerEmail": "jane.smith@example.com"
}

Output (example):

{
    "Name": "abc123",
    "Email": "xyz789",
    "customerName": "def456",
    "customerEmail": "uvw012"
}

XML Anonymization

Input:

<?xml version="1.0" encoding="UTF-8"?>
<Root>
    <Name>John Doe</Name>
    <Email>john.doe@example.com</Email>
    <customerName>Jane Smith</customerName>
    <customerEmail>jane.smith@example.com</customerEmail>
</Root>

Output (example):

<?xml version="1.0" encoding="UTF-8"?>
<Root>
    <Name>abc123</Name>
    <Email>xyz789</Email>
    <customerName>def456</customerName>
    <customerEmail>uvw012</customerEmail>
</Root>

CSV Anonymization

Input:

Name,Email,Phone,Address
John Doe,john.doe@example.com,123-456-7890,123 Main St
Jane Smith,jane.smith@example.com,987-654-3210,456 Oak Ave

Output (example):

Name,Email,Phone,Address
abc123,xyz789,def456,uvw012
ghi789,jkl012,mno345,pqr678

Note: The CSV anonymization will:

  • Preserve the header row
  • Anonymize values in specified columns
  • Maintain consistent anonymization across multiple files
  • Handle quoted values and special characters correctly

License

This project is licensed under the MIT License - see the LICENSE file for details.

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.2505.1209 327 5/12/2025
1.0.2505.1208 308 5/12/2025
1.0.2504.1406 280 4/14/2025
1.0.0 261 4/10/2025