Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions NuciText.Obfuscation/INuciText.Obfuscation.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,30 @@
namespace NuciText.Obfuscation
{
/// <summary>
/// Defines the interface for the NuciText obfuscator.
/// </summary>
public interface INuciTextObfuscator
{
/// <summary>
/// Deobfuscates the specified text.
/// </summary>
/// <param name="text">The text to deobfuscate.</param>
/// <returns>The deobfuscated text.</returns>
string Deobfuscate(string text);

/// <summary>
/// Obfuscates the specified text.
/// </summary>
/// <param name="text">The text to obfuscate.</param>
/// <returns>The obfuscated text.</returns>
string Obfuscate(string text);

/// <summary>
/// Obfuscates the specified text using the provided options.
/// </summary>
/// <param name="text">The text to obfuscate.</param>
/// <param name="options">The options to use for obfuscation.</param>
/// <returns>The obfuscated text.</returns>
string Obfuscate(string text, NuciTextObfuscatorOptions options);
}
}
16 changes: 16 additions & 0 deletions NuciText.Obfuscation/NuciText.Obfuscation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,11 @@ public NuciTextObfuscator(string seed) : this(seed.GetHashCode()) { }

public NuciTextObfuscator() : this(Environment.TickCount) { }

/// <summary>
/// Deobfuscates the specified text.
/// </summary>
/// <param name="text">The text to deobfuscate.</param>
/// <returns>The deobfuscated text.</returns>
public string Deobfuscate(string text)
{
if (text is null)
Expand Down Expand Up @@ -257,9 +262,20 @@ public string Deobfuscate(string text)
return builder.ToString();
}

/// <summary>
/// Obfuscates the specified text.
/// </summary>
/// <param name="text">The text to obfuscate.</param>
/// <returns>The obfuscated text.</returns>
public string Obfuscate(string text)
=> Obfuscate(text, new NuciTextObfuscatorOptions());

/// <summary>
/// Obfuscates the specified text using the provided options.
/// </summary>
/// <param name="text">The text to obfuscate.</param>
/// <param name="options">The options to use for obfuscation.</param>
/// <returns>The obfuscated text.</returns>
public string Obfuscate(string text, NuciTextObfuscatorOptions options)
{
if (text is null)
Expand Down
6 changes: 6 additions & 0 deletions NuciText.Obfuscation/NuciTextObfuscatorOptions.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
namespace NuciText.Obfuscation
{
/// <summary>
/// Defines the options for the NuciText obfuscator, allowing customisation of the obfuscation process.
/// </summary>
public sealed class NuciTextObfuscatorOptions
{
/// <summary>
/// Gets or sets a value indicating whether to use approximate replacements for characters.
/// </summary>
public bool UseApproximateReplacements { get; set; } = false;
}
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![Donate](https://img.shields.io/badge/-%E2%99%A5%20Donate-%23ff69b4)](https://hmlendea.go.ro/fund.html) [![Latest GitHub release](https://img.shields.io/github/v/release/hmlendea/nuciapi)](https://github.com/hmlendea/nuciapi/releases/latest) [![Build Status](https://github.com/hmlendea/nucitext.obfuscation/actions/workflows/dotnet.yml/badge.svg)](https://github.com/hmlendea/nucitext.obfuscation/actions/workflows/dotnet.yml)
[![Donate](https://img.shields.io/badge/-%E2%99%A5%20Donate-%23ff69b4)](https://hmlendea.go.ro/fund.html) [![Latest GitHub release](https://img.shields.io/github/v/release/hmlendea/nucitext.obfuscation)](https://github.com/hmlendea/nucitext.obfuscation/releases/latest) [![Build Status](https://github.com/hmlendea/nucitext.obfuscation/actions/workflows/dotnet.yml/badge.svg)](https://github.com/hmlendea/nucitext.obfuscation/actions/workflows/dotnet.yml)

# Installation

Expand Down