Added KeyGen, Fixed Bugs, Fixed Tests

This commit is contained in:
Jordan Wages 2025-02-14 04:52:55 -06:00
parent 63aba3c9bb
commit affd2899cf
236 changed files with 17455 additions and 3979 deletions

View file

@ -6,7 +6,7 @@
<Nullable>enable</Nullable>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
<PackageReadmeFile>README.md</PackageReadmeFile>
<Version>1.0.3</Version>
<Version>1.0.4</Version>
</PropertyGroup>
<ItemGroup>

View file

@ -0,0 +1,225 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Security.Cryptography;
using System.Text;
using System.Net;
namespace CapyKit.Helpers
{
/// <summary> A class that contains methods for managing key creation and validation against a master key. </summary>
public class KeyHelper
{
/// <summary> The master key accessor function. </summary>
private Func<byte[]> masterKeyAccessor;
/// <summary> The salt size accessor function. </summary>
private Func<int> saltSizeAccessor;
/// <summary> Number of parts accessor function. </summary>
private Func<int> numPartsAccessor;
/// <summary> Sets the master key. </summary>
/// <param name="accessor"> The accessor function. </param>
public void SetMasterKeyAccessor(Func<byte[]> accessor)
{
this.masterKeyAccessor = accessor;
}
/// <summary> Gets the master key. </summary>
/// <exception cref="InvalidOperationException">
/// Thrown when the requested operation is invalid.
/// </exception>
/// <returns> An array of byte. </returns>
public byte[] GetMasterKey()
{
if (this.masterKeyAccessor == null)
{
var errorMessage = "Master key accessor not set.";
CapyEventReporter.EmitEvent(EventLevel.Error, errorMessage);
throw new InvalidOperationException(errorMessage);
}
return this.masterKeyAccessor();
}
/// <summary> Sets the salt size (in bytes). Default is 4. </summary>
/// <param name="accessor"> The accessor function. </param>
public void SetSaltSizeAccessor(Func<int> accessor)
{
this.saltSizeAccessor = accessor;
}
/// <summary> Gets the salt size. </summary>
/// <returns> The salt size. </returns>
public int GetSaltSize()
{
return this.saltSizeAccessor != null ? this.saltSizeAccessor() : 4;
}
/// <summary> Set and get the number of parts for the formatted key. Default is 2. </summary>
/// <param name="accessor"> The accessor function. </param>
public void SetNumPartsAccessor(Func<int> accessor)
{
this.numPartsAccessor = accessor;
}
/// <summary> Gets the number parts. </summary>
/// <exception cref="ArgumentException">
/// Thrown when one or more arguments have unsupported or illegal values.
/// </exception>
/// <returns> The number parts. </returns>
public int GetNumParts()
{
int parts = this.numPartsAccessor != null ? this.numPartsAccessor() : 2;
if (parts < 2)
{
var errorMessage = "Number of parts must be 2 or more.";
CapyEventReporter.EmitEvent(EventLevel.Error, errorMessage);
throw new ArgumentException(errorMessage);
}
return parts;
}
/// <summary>
/// Computes an HMAC-SHA256 over the salt using the master key and truncates it to the same
/// number of bytes as the salt.
/// </summary>
/// <param name="salt"> The salt. </param>
/// <returns> The calculated signature. </returns>
private byte[] ComputeSignature(byte[] salt)
{
byte[] masterKey = GetMasterKey();
using (var hmac = new HMACSHA256(masterKey))
{
byte[] hash = hmac.ComputeHash(salt);
int sigLength = salt.Length;
byte[] signature = new byte[sigLength];
Array.Copy(hash, signature, sigLength);
return signature;
}
}
/// <summary> Converts a byte array to a hex string. </summary>
/// <param name="bytes"> The bytes. </param>
/// <returns> A string. </returns>
private string BytesToHex(byte[] bytes)
{
StringBuilder sb = new StringBuilder(bytes.Length * 2);
foreach (var b in bytes)
{
sb.Append(b.ToString("X2"));
}
return sb.ToString();
}
/// <summary> Converts a hex string back to a byte array. </summary>
/// <exception cref="ArgumentException">
/// Thrown when one or more arguments have unsupported or illegal values.
/// </exception>
/// <param name="hex"> The hexadecimal. </param>
/// <returns> A byte[]. </returns>
private byte[] HexToBytes(string hex)
{
if (hex.Length % 2 != 0)
{
var errorMessage = "Invalid hex string.";
CapyEventReporter.EmitEvent(EventLevel.Error, errorMessage);
throw new ArgumentException(errorMessage);
}
byte[] bytes = new byte[hex.Length / 2];
for (int i = 0; i < hex.Length; i += 2)
{
bytes[i / 2] = Convert.ToByte(hex.Substring(i, 2), 16);
}
return bytes;
}
/// <summary>
/// Formats the given hex string into the desired number of parts (separated by dashes).
/// </summary>
/// <param name="hex"> The hexadecimal. </param>
/// <returns> The formatted key. </returns>
private string FormatKey(string hex)
{
int parts = GetNumParts();
int totalLength = hex.Length;
int baseLength = totalLength / parts;
int remainder = totalLength % parts;
StringBuilder formatted = new StringBuilder();
int currentIndex = 0;
for (int i = 0; i < parts; i++)
{
// Distribute any extra characters across the first few groups.
int groupLength = baseLength + (i < remainder ? 1 : 0);
formatted.Append(hex.Substring(currentIndex, groupLength));
currentIndex += groupLength;
if (i < parts - 1)
formatted.Append("-");
}
return formatted.ToString();
}
/// <summary> Generates a random key. </summary>
/// <returns> The key. </returns>
public string GenerateKey()
{
int saltSize = GetSaltSize();
byte[] salt = new byte[saltSize];
using (var rng = RandomNumberGenerator.Create())
{
rng.GetBytes(salt);
}
byte[] signature = ComputeSignature(salt);
string saltHex = BytesToHex(salt);
string signatureHex = BytesToHex(signature);
string combinedHex = saltHex + signatureHex;
return FormatKey(combinedHex);
}
/// <summary> Validates the provided key. </summary>
/// <param name="providedKey"> The provided key. </param>
/// <returns> True if it succeeds, false if it fails. </returns>
/// <seealso cref="GetMasterKey"/>
/// <seealso cref="SetMasterKeyAccessor(Func{byte[]})"/>
/// <seealso cref="masterKeyAccessor"/>
public bool ValidateKey(string providedKey)
{
if (string.IsNullOrWhiteSpace(providedKey))
return false;
// Remove dashes.
string cleanedKey = providedKey.Replace("-", "");
int saltSize = GetSaltSize();
int expectedTotalHexLength = 4 * saltSize; // salt (2*saltSize) + signature (2*saltSize)
if (cleanedKey.Length != expectedTotalHexLength)
return false;
string saltHex = cleanedKey.Substring(0, 2 * saltSize);
string signatureHex = cleanedKey.Substring(2 * saltSize);
byte[] salt;
byte[] providedSignature;
try
{
salt = HexToBytes(saltHex);
providedSignature = HexToBytes(signatureHex);
}
catch
{
return false;
}
byte[] expectedSignature = ComputeSignature(salt);
if (expectedSignature.Length != providedSignature.Length)
return false;
for (int i = 0; i < expectedSignature.Length; i++)
{
if (expectedSignature[i] != providedSignature[i])
return false;
}
return true;
}
}
}

View file

@ -50,7 +50,7 @@ namespace CapyKit.Helpers
public static bool CompareHashedPassword<T>(Password existingPassword, string password, byte[] salt, params object[] args)
{
var providedPassword = typeof(SecurityHelper)
.GetMethod("GetPassword")
.GetMethod("GetPassword", new Type[] { typeof(string), typeof(byte[]), typeof(object[]) })
?.MakeGenericMethod(typeof(T))
?.Invoke(null, new object[] { password, salt, args });
@ -75,7 +75,7 @@ namespace CapyKit.Helpers
var algorithmType = algorithm.GetType();
var providedPassword = typeof(SecurityHelper)
.GetMethod("GetPassword")
.GetMethod("GetPassword", new Type[] {typeof(string), typeof(byte[]), typeof(object[])})
?.MakeGenericMethod(algorithmType)
?.Invoke(null, new object[] { password, salt, args });
@ -131,10 +131,9 @@ namespace CapyKit.Helpers
/// </returns>
public static Password GetPassword<T>(string password, byte[] salt, params object[] args) where T : IPasswordAlgorithm
{
var allArgs = args.Prepend(salt).Prepend(password).ToArray(); // Prepend in reverse order so that password precedes salt.
var argTypes = allArgs.Select(arg => arg.GetType()).ToArray();
//var allArgs = args.Prepend(salt).Prepend(password).ToArray(); // Prepend in reverse order so that password precedes salt.
var argTypes = args.Select(arg => arg.GetType()).ToArray();
var algorithmConstructor = typeof(T).GetConstructor(argTypes);
if (algorithmConstructor == null)
{
CapyEventReporter.EmitEvent(EventLevel.Error, "Cannot find a constructor for {0} that matches the given arguments: {1}",
@ -146,7 +145,7 @@ namespace CapyKit.Helpers
return default(Password);
}
var passwordInstance = (T)algorithmConstructor.Invoke(allArgs);
var passwordInstance = (T)algorithmConstructor.Invoke(args);
if (passwordInstance == null)
{
@ -154,7 +153,7 @@ namespace CapyKit.Helpers
args: new[]
{
typeof(T).Name,
string.Join(",", allArgs)
string.Join(",", args)
});
return default(Password);
}
@ -208,10 +207,19 @@ namespace CapyKit.Helpers
}
/// <summary> Gets a cryptographically strong random password. </summary>
/// <param name="length"> The length of the password to generate. </param>
/// <param name="length"> The length of the password to generate. </param>
/// <param name="validCharacters">
/// An array of <see cref="ValidCharacterCollection"/> enumeration values representing the desired
/// character sets.
/// </param>
/// <returns> The password. </returns>
public static string GetRandomPassword(int length, params ValidCharacterCollection[] validCharacters)
{
if (validCharacters.Length == 0)
{
CapyEventReporter.EmitEvent(EventLevel.Warning, "No valid characters were provided, so all valid caharacters will be assumed.");
validCharacters = new[] { ValidCharacterCollection.Lowercase, ValidCharacterCollection.Uppercase, ValidCharacterCollection.Numbers, ValidCharacterCollection.Special };
}
return GetRandomString(length, validCharacters);
}

View file

@ -194,6 +194,16 @@ namespace CapyKit
#endregion
#region Constructor
/// <summary> Default constructor. </summary>
public Pbkdf2Algorithm()
{
//
}
#endregion
#region Methods
/// <summary> Encrypts the given password using a PBKDF2 algorithm. </summary>

View file

@ -7,7 +7,7 @@ A hash set storing unique identifiers for events intended to only be emitted onc
## Definition
**Namespace:** <a href="N_CapyKit.md">CapyKit</a>
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.2
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.4
**C#**
``` C#

View file

@ -7,7 +7,7 @@ The earth's radius in kilometers.
## Definition
**Namespace:** <a href="N_CapyKit_Helpers.md">CapyKit.Helpers</a>
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.2
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.4
**C#**
``` C#

View file

@ -7,7 +7,7 @@ Ratio of miles per kilometer .
## Definition
**Namespace:** <a href="N_CapyKit_Helpers.md">CapyKit.Helpers</a>
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.2
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.4
**C#**
``` C#

View file

@ -7,7 +7,7 @@ The valid hexidecimal characters.
## Definition
**Namespace:** <a href="N_CapyKit_Helpers.md">CapyKit.Helpers</a>
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.2
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.4
**C#**
``` C#

View file

@ -7,7 +7,7 @@
## Definition
**Namespace:** <a href="N_CapyKit_Helpers.md">CapyKit.Helpers</a>
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.2
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.4
**C#**
``` C#

View file

@ -0,0 +1,31 @@
# masterKeyAccessor Field
The master key accessor function.
## Definition
**Namespace:** <a href="N_CapyKit_Helpers.md">CapyKit.Helpers</a>
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.4
**C#**
``` C#
private Func<byte[]> masterKeyAccessor
```
**F#**
``` F#
val mutable private masterKeyAccessor: Func<byte[]>
```
#### Field Value
<a href="https://learn.microsoft.com/dotnet/api/system.func-1" target="_blank" rel="noopener noreferrer">Func</a>(<a href="https://learn.microsoft.com/dotnet/api/system.byte" target="_blank" rel="noopener noreferrer">Byte</a>[])
## See Also
#### Reference
<a href="T_CapyKit_Helpers_KeyHelper.md">KeyHelper Class</a>
<a href="N_CapyKit_Helpers.md">CapyKit.Helpers Namespace</a>

View file

@ -0,0 +1,31 @@
# numPartsAccessor Field
Number of parts accessor function.
## Definition
**Namespace:** <a href="N_CapyKit_Helpers.md">CapyKit.Helpers</a>
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.4
**C#**
``` C#
private Func<int> numPartsAccessor
```
**F#**
``` F#
val mutable private numPartsAccessor: Func<int>
```
#### Field Value
<a href="https://learn.microsoft.com/dotnet/api/system.func-1" target="_blank" rel="noopener noreferrer">Func</a>(<a href="https://learn.microsoft.com/dotnet/api/system.int32" target="_blank" rel="noopener noreferrer">Int32</a>)
## See Also
#### Reference
<a href="T_CapyKit_Helpers_KeyHelper.md">KeyHelper Class</a>
<a href="N_CapyKit_Helpers.md">CapyKit.Helpers Namespace</a>

View file

@ -0,0 +1,31 @@
# saltSizeAccessor Field
The salt size accessor function.
## Definition
**Namespace:** <a href="N_CapyKit_Helpers.md">CapyKit.Helpers</a>
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.4
**C#**
``` C#
private Func<int> saltSizeAccessor
```
**F#**
``` F#
val mutable private saltSizeAccessor: Func<int>
```
#### Field Value
<a href="https://learn.microsoft.com/dotnet/api/system.func-1" target="_blank" rel="noopener noreferrer">Func</a>(<a href="https://learn.microsoft.com/dotnet/api/system.int32" target="_blank" rel="noopener noreferrer">Int32</a>)
## See Also
#### Reference
<a href="T_CapyKit_Helpers_KeyHelper.md">KeyHelper Class</a>
<a href="N_CapyKit_Helpers.md">CapyKit.Helpers Namespace</a>

View file

@ -7,7 +7,7 @@ A string of all the lower case characters.
## Definition
**Namespace:** <a href="N_CapyKit_Helpers.md">CapyKit.Helpers</a>
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.2
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.4
**C#**
``` C#

View file

@ -7,7 +7,7 @@ A string of all the numeric characters.
## Definition
**Namespace:** <a href="N_CapyKit_Helpers.md">CapyKit.Helpers</a>
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.2
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.4
**C#**
``` C#

View file

@ -7,7 +7,7 @@ Default size to use when generating a new salt.
## Definition
**Namespace:** <a href="N_CapyKit_Helpers.md">CapyKit.Helpers</a>
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.2
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.4
**C#**
``` C#

View file

@ -7,7 +7,7 @@ A string of the most common non-alphanumeric characters.
## Definition
**Namespace:** <a href="N_CapyKit_Helpers.md">CapyKit.Helpers</a>
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.2
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.4
**C#**
``` C#

View file

@ -7,7 +7,7 @@ A string of all the upper case characters.
## Definition
**Namespace:** <a href="N_CapyKit_Helpers.md">CapyKit.Helpers</a>
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.2
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.4
**C#**
``` C#

View file

@ -7,7 +7,7 @@ Private delegate function that retrieves a setting with the given `key`.
## Definition
**Namespace:** <a href="N_CapyKit_Helpers.md">CapyKit.Helpers</a>
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.2
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.4
**C#**
``` C#

View file

@ -7,7 +7,7 @@ Private delegate function that detects if a setting with a given `key` exists. R
## Definition
**Namespace:** <a href="N_CapyKit_Helpers.md">CapyKit.Helpers</a>
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.2
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.4
**C#**
``` C#

View file

@ -7,7 +7,7 @@
## Definition
**Namespace:** <a href="N_CapyKit.md">CapyKit</a>
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.2
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.4
**C#**
``` C#

View file

@ -7,7 +7,7 @@ The default number of iterations.
## Definition
**Namespace:** <a href="N_CapyKit.md">CapyKit</a>
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.2
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.4
**C#**
``` C#

View file

@ -7,7 +7,7 @@
## Definition
**Namespace:** <a href="N_CapyKit.md">CapyKit</a>
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.2
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.4
**C#**
``` C#

View file

@ -7,7 +7,7 @@ The zero-based index of the pooled item.
## Definition
**Namespace:** <a href="N_CapyKit.md">CapyKit</a>
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.2
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.4
**C#**
``` C#

View file

@ -7,7 +7,7 @@ The pooled item.
## Definition
**Namespace:** <a href="N_CapyKit.md">CapyKit</a>
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.2
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.4
**C#**
``` C#

View file

@ -7,7 +7,7 @@ A flag indicating whether the item is locked or not.
## Definition
**Namespace:** <a href="N_CapyKit.md">CapyKit</a>
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.2
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.4
**C#**
``` C#

View file

@ -7,7 +7,7 @@ The name of the pooled item <a href="https://learn.microsoft.com/dotnet/api/syst
## Definition
**Namespace:** <a href="N_CapyKit.md">CapyKit</a>
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.2
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.4
**C#**
``` C#

View file

@ -7,7 +7,7 @@ The collection of pooled items.
## Definition
**Namespace:** <a href="N_CapyKit.md">CapyKit</a>
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.2
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.4
**C#**
``` C#

View file

@ -7,7 +7,7 @@
## Definition
**Namespace:** <a href="N_CapyKit.md">CapyKit</a>
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.2
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.4
**C#**
``` C#

View file

@ -7,7 +7,7 @@ The expression to retrieve the property.
## Definition
**Namespace:** <a href="N_CapyKit.md">CapyKit</a>
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.2
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.4
**C#**
``` C#

View file

@ -0,0 +1,31 @@
# _keyHelper Field
\[Missing &lt;summary&gt; documentation for "F:Tests.Helpers.KeyHelperTests._keyHelper"\]
## Definition
**Namespace:** <a href="N_Tests_Helpers.md">Tests.Helpers</a>
**Assembly:** Tests (in Tests.exe) Version: 1.0.0
**C#**
``` C#
private KeyHelper _keyHelper
```
**F#**
``` F#
val mutable private _keyHelper: KeyHelper
```
#### Field Value
<a href="T_CapyKit_Helpers_KeyHelper.md">KeyHelper</a>
## See Also
#### Reference
<a href="T_Tests_Helpers_KeyHelperTests.md">KeyHelperTests Class</a>
<a href="N_Tests_Helpers.md">Tests.Helpers Namespace</a>

View file

@ -0,0 +1,24 @@
# KeyHelper Fields
## Fields
<table>
<tr>
<td><a href="F_CapyKit_Helpers_KeyHelper_masterKeyAccessor.md">masterKeyAccessor</a></td>
<td>The master key accessor function.</td></tr>
<tr>
<td><a href="F_CapyKit_Helpers_KeyHelper_numPartsAccessor.md">numPartsAccessor</a></td>
<td>Number of parts accessor function.</td></tr>
<tr>
<td><a href="F_CapyKit_Helpers_KeyHelper_saltSizeAccessor.md">saltSizeAccessor</a></td>
<td>The salt size accessor function.</td></tr>
</table>
## See Also
#### Reference
<a href="T_CapyKit_Helpers_KeyHelper.md">KeyHelper Class</a>
<a href="N_CapyKit_Helpers.md">CapyKit.Helpers Namespace</a>

View file

@ -0,0 +1,18 @@
# KeyHelperTests Fields
## Fields
<table>
<tr>
<td><a href="F_Tests_Helpers_KeyHelperTests__keyHelper.md">_keyHelper</a></td>
<td> </td></tr>
</table>
## See Also
#### Reference
<a href="T_Tests_Helpers_KeyHelperTests.md">KeyHelperTests Class</a>
<a href="N_Tests_Helpers.md">Tests.Helpers Namespace</a>

View file

@ -7,7 +7,7 @@ Gets the value of the enumeration represented by this attribute.
## Definition
**Namespace:** <a href="N_CapyKit_Attributes.md">CapyKit.Attributes</a>
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.2
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.4
**C#**
``` C#

View file

@ -7,7 +7,7 @@ Initializes a new instance of the <a href="T_CapyKit_Attributes_EnumerationDescr
## Definition
**Namespace:** <a href="N_CapyKit_Attributes.md">CapyKit.Attributes</a>
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.2
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.4
**C#**
``` C#

View file

@ -7,7 +7,7 @@ Gets a parameterized formatted string for the specified index.
## Definition
**Namespace:** <a href="N_CapyKit_Attributes.md">CapyKit.Attributes</a>
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.2
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.4
**C#**
``` C#

View file

@ -7,7 +7,7 @@ Default constructor. Initializes a new instance of the <a href="T_CapyKit_Attrib
## Definition
**Namespace:** <a href="N_CapyKit_Attributes.md">CapyKit.Attributes</a>
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.2
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.4
**C#**
``` C#

View file

@ -7,7 +7,7 @@ Constructor. Initializes a new instance of the <a href="T_CapyKit_Attributes_Val
## Definition
**Namespace:** <a href="N_CapyKit_Attributes.md">CapyKit.Attributes</a>
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.2
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.4
**C#**
``` C#

View file

@ -7,7 +7,7 @@ Initializes a new instance of the CapyEventArgs class with the specified event l
## Definition
**Namespace:** <a href="N_CapyKit.md">CapyKit</a>
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.2
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.4
**C#**
``` C#

View file

@ -7,7 +7,7 @@ Emits an event with the given severity level, message, and method name.
## Definition
**Namespace:** <a href="N_CapyKit.md">CapyKit</a>
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.2
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.4
**C#**
``` C#

View file

@ -7,7 +7,7 @@ Emits an event with the given severity level, message, unique identifier, and me
## Definition
**Namespace:** <a href="N_CapyKit.md">CapyKit</a>
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.2
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.4
**C#**
``` C#

View file

@ -7,7 +7,7 @@ Subscribes the specified event handler to the event with the given subscription
## Definition
**Namespace:** <a href="N_CapyKit.md">CapyKit</a>
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.2
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.4
**C#**
``` C#

View file

@ -7,7 +7,7 @@ Unsubscribes the specified event handler from the event with the given origin.
## Definition
**Namespace:** <a href="N_CapyKit.md">CapyKit</a>
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.2
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.4
**C#**
``` C#

View file

@ -7,7 +7,7 @@ Initializes the static fields of the <a href="T_CapyKit_CapyEventReporter.md">Ca
## Definition
**Namespace:** <a href="N_CapyKit.md">CapyKit</a>
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.2
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.4
**C#**
``` C#

View file

@ -0,0 +1,28 @@
# Color Constructor
Initializes a new instance of the <a href="T_CapyKit_Color.md">Color</a> class
## Definition
**Namespace:** <a href="N_CapyKit.md">CapyKit</a>
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.4
**C#**
``` C#
public Color()
```
**F#**
``` F#
new : unit -> Color
```
## See Also
#### Reference
<a href="T_CapyKit_Color.md">Color Class</a>
<a href="N_CapyKit.md">CapyKit Namespace</a>

View file

@ -7,7 +7,7 @@ Initializes a new instance of the <a href="T_CapyKit_EncryptedValue_1.md">Encryp
## Definition
**Namespace:** <a href="N_CapyKit.md">CapyKit</a>
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.2
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.4
**C#**
``` C#

View file

@ -7,7 +7,7 @@ An <a href="https://learn.microsoft.com/dotnet/api/system.enum" target="_blank"
## Definition
**Namespace:** <a href="N_CapyKit_Extensions.md">CapyKit.Extensions</a>
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.2
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.4
**C#**
``` C#

View file

@ -7,7 +7,7 @@ An <a href="https://learn.microsoft.com/dotnet/api/system.enum" target="_blank"
## Definition
**Namespace:** <a href="N_CapyKit_Extensions.md">CapyKit.Extensions</a>
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.2
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.4
**C#**
``` C#

View file

@ -7,7 +7,7 @@ An <a href="https://learn.microsoft.com/dotnet/api/system.enum" target="_blank"
## Definition
**Namespace:** <a href="N_CapyKit_Extensions.md">CapyKit.Extensions</a>
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.2
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.4
**C#**
``` C#

View file

@ -7,7 +7,7 @@ An <a href="https://learn.microsoft.com/dotnet/api/system.enum" target="_blank"
## Definition
**Namespace:** <a href="N_CapyKit_Extensions.md">CapyKit.Extensions</a>
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.2
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.4
**C#**
``` C#

View file

@ -7,7 +7,7 @@ A *T* extension method that parses a string into an enumeration.
## Definition
**Namespace:** <a href="N_CapyKit_Extensions.md">CapyKit.Extensions</a>
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.2
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.4
**C#**
``` C#

View file

@ -7,7 +7,7 @@ A *T* extension method that parses a string into an enumeration.
## Definition
**Namespace:** <a href="N_CapyKit_Extensions.md">CapyKit.Extensions</a>
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.2
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.4
**C#**
``` C#

View file

@ -7,7 +7,7 @@ Enumerates distinct items in this collection as defined by the key *property*.
## Definition
**Namespace:** <a href="N_CapyKit_Extensions.md">CapyKit.Extensions</a>
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.2
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.4
**C#**
``` C#

View file

@ -7,7 +7,7 @@ Filters out items matching a *predicate* from the collection.
## Definition
**Namespace:** <a href="N_CapyKit_Extensions.md">CapyKit.Extensions</a>
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.2
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.4
**C#**
``` C#

View file

@ -7,7 +7,7 @@ Filters out items matching a *predicate* from the collection.
## Definition
**Namespace:** <a href="N_CapyKit_Extensions.md">CapyKit.Extensions</a>
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.2
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.4
**C#**
``` C#

View file

@ -7,7 +7,7 @@ An IEnumable&lt;T&gt; extension method that left outer join.
## Definition
**Namespace:** <a href="N_CapyKit_Extensions.md">CapyKit.Extensions</a>
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.2
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.4
**C#**
``` C#

View file

@ -7,7 +7,7 @@ An IQueryable&lt;T&gt; extension method that left outer join.
## Definition
**Namespace:** <a href="N_CapyKit_Extensions.md">CapyKit.Extensions</a>
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.2
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.4
**C#**
``` C#

View file

@ -7,7 +7,7 @@ An IQueryable&lt;T&gt; extension method that left outer join.
## Definition
**Namespace:** <a href="N_CapyKit_Extensions.md">CapyKit.Extensions</a>
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.2
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.4
**C#**
``` C#

View file

@ -7,7 +7,7 @@ The number of pages of *pageSize* size in the given collection.
## Definition
**Namespace:** <a href="N_CapyKit_Extensions.md">CapyKit.Extensions</a>
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.2
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.4
**C#**
``` C#

View file

@ -7,7 +7,7 @@ The number of pages of *pageSize* size in the given collection.
## Definition
**Namespace:** <a href="N_CapyKit_Extensions.md">CapyKit.Extensions</a>
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.2
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.4
**C#**
``` C#

View file

@ -7,7 +7,7 @@ Get a page of items from a collection, skipping *pageNumber* pages of *pageSize*
## Definition
**Namespace:** <a href="N_CapyKit_Extensions.md">CapyKit.Extensions</a>
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.2
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.4
**C#**
``` C#

View file

@ -7,7 +7,7 @@ Get a page of items from a collection, skipping *pageNumber* pages of *pageSize*
## Definition
**Namespace:** <a href="N_CapyKit_Extensions.md">CapyKit.Extensions</a>
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.2
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.4
**C#**
``` C#

View file

@ -0,0 +1,45 @@
# UpdateProperties(Object, Object) Method
An object extension method that updates the properties of a given *target* object with the values from a given *source* object.
## Definition
**Namespace:** <a href="N_CapyKit_Extensions.md">CapyKit.Extensions</a>
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.4
**C#**
``` C#
public static void UpdateProperties(
this Object target,
Object source
)
```
**F#**
``` F#
[<ExtensionAttribute>]
static member UpdateProperties :
target : Object *
source : Object -> unit
```
#### Parameters
<dl><dt>  <a href="https://learn.microsoft.com/dotnet/api/system.object" target="_blank" rel="noopener noreferrer">Object</a></dt><dd>The target object to act on.</dd><dt>  <a href="https://learn.microsoft.com/dotnet/api/system.object" target="_blank" rel="noopener noreferrer">Object</a></dt><dd>Source for the new property values.</dd></dl>
#### Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type <a href="https://learn.microsoft.com/dotnet/api/system.object" target="_blank" rel="noopener noreferrer">Object</a>. When you use instance method syntax to call this method, omit the first parameter. For more information, see <a href="https://docs.microsoft.com/dotnet/visual-basic/programming-guide/language-features/procedures/extension-methods" target="_blank" rel="noopener noreferrer">
Extension Methods (Visual Basic)</a> or <a href="https://docs.microsoft.com/dotnet/csharp/programming-guide/classes-and-structs/extension-methods" target="_blank" rel="noopener noreferrer">
Extension Methods (C# Programming Guide)</a>.
## See Also
#### Reference
<a href="T_CapyKit_Extensions_ObjectExtensions.md">ObjectExtensions Class</a>
<a href="Overload_CapyKit_Extensions_ObjectExtensions_UpdateProperties.md">UpdateProperties Overload</a>
<a href="N_CapyKit_Extensions.md">CapyKit.Extensions Namespace</a>

View file

@ -0,0 +1,49 @@
# UpdateProperties&lt;T&gt;(T, T) Method
An object extension method that updates the properties of a given *target* object with the values from a given *source* object.
## Definition
**Namespace:** <a href="N_CapyKit_Extensions.md">CapyKit.Extensions</a>
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.4
**C#**
``` C#
public static void UpdateProperties<T>(
this T target,
T source
)
```
**F#**
``` F#
[<ExtensionAttribute>]
static member UpdateProperties :
target : 'T *
source : 'T -> unit
```
#### Parameters
<dl><dt>  T</dt><dd>The target object to act on.</dd><dt>  T</dt><dd>Source for the new property values.</dd></dl>
#### Type Parameters
<dl><dt /><dd>Generic type parameter.</dd></dl>
#### Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type T. When you use instance method syntax to call this method, omit the first parameter. For more information, see <a href="https://docs.microsoft.com/dotnet/visual-basic/programming-guide/language-features/procedures/extension-methods" target="_blank" rel="noopener noreferrer">
Extension Methods (Visual Basic)</a> or <a href="https://docs.microsoft.com/dotnet/csharp/programming-guide/classes-and-structs/extension-methods" target="_blank" rel="noopener noreferrer">
Extension Methods (C# Programming Guide)</a>.
## See Also
#### Reference
<a href="T_CapyKit_Extensions_ObjectExtensions.md">ObjectExtensions Class</a>
<a href="Overload_CapyKit_Extensions_ObjectExtensions_UpdateProperties.md">UpdateProperties Overload</a>
<a href="N_CapyKit_Extensions.md">CapyKit.Extensions Namespace</a>

View file

@ -7,7 +7,7 @@ Replaces a null or empty string with a specified replacement string.
## Definition
**Namespace:** <a href="N_CapyKit_Extensions.md">CapyKit.Extensions</a>
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.2
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.4
**C#**
``` C#

View file

@ -7,7 +7,7 @@ Replaces a null or whitespace string with a specified replacement string.
## Definition
**Namespace:** <a href="N_CapyKit_Extensions.md">CapyKit.Extensions</a>
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.2
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.4
**C#**
``` C#

View file

@ -7,7 +7,7 @@ Calculates the hash of a given string using an <a href="https://learn.microsoft.
## Definition
**Namespace:** <a href="N_CapyKit_Helpers.md">CapyKit.Helpers</a>
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.2
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.4
**C#**
``` C#

View file

@ -7,7 +7,7 @@ Calculates the hexadecimal hash.
## Definition
**Namespace:** <a href="N_CapyKit_Helpers.md">CapyKit.Helpers</a>
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.2
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.4
**C#**
``` C#

View file

@ -7,7 +7,7 @@ Convers degrees to radians.
## Definition
**Namespace:** <a href="N_CapyKit_Helpers.md">CapyKit.Helpers</a>
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.2
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.4
**C#**
``` C#

View file

@ -7,7 +7,7 @@ Gets the distance between two points on earth using the `haversine` formula.
## Definition
**Namespace:** <a href="N_CapyKit_Helpers.md">CapyKit.Helpers</a>
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.2
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.4
**C#**
``` C#

View file

@ -7,7 +7,7 @@ Gets the distance between two points on earth using the `haversine` formula.
## Definition
**Namespace:** <a href="N_CapyKit_Helpers.md">CapyKit.Helpers</a>
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.2
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.4
**C#**
``` C#

View file

@ -7,7 +7,7 @@ Converts kilometers to miles.
## Definition
**Namespace:** <a href="N_CapyKit_Helpers.md">CapyKit.Helpers</a>
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.2
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.4
**C#**
``` C#

View file

@ -7,7 +7,7 @@ Converts miles to kilometers.
## Definition
**Namespace:** <a href="N_CapyKit_Helpers.md">CapyKit.Helpers</a>
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.2
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.4
**C#**
``` C#

View file

@ -7,7 +7,7 @@ Converts radians to degrees.
## Definition
**Namespace:** <a href="N_CapyKit_Helpers.md">CapyKit.Helpers</a>
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.2
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.4
**C#**
``` C#

View file

@ -7,7 +7,7 @@ Compresses a given object using the `gzip` algorithm.
## Definition
**Namespace:** <a href="N_CapyKit_Helpers.md">CapyKit.Helpers</a>
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.2
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.4
**C#**
``` C#

View file

@ -7,7 +7,7 @@ Compresses a given object to a string using `base64` encoding of `gzip` format.
## Definition
**Namespace:** <a href="N_CapyKit_Helpers.md">CapyKit.Helpers</a>
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.2
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.4
**C#**
``` C#

View file

@ -7,7 +7,7 @@ Decompresses the given `base64` string in `gzip` format.
## Definition
**Namespace:** <a href="N_CapyKit_Helpers.md">CapyKit.Helpers</a>
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.2
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.4
**C#**
``` C#

View file

@ -7,7 +7,7 @@ Decompresses a given compressed `gzip` byte stream.
## Definition
**Namespace:** <a href="N_CapyKit_Helpers.md">CapyKit.Helpers</a>
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.2
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.4
**C#**
``` C#

View file

@ -7,7 +7,7 @@ Decompresses a given `base64` encoded string of `gzip` format.
## Definition
**Namespace:** <a href="N_CapyKit_Helpers.md">CapyKit.Helpers</a>
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.2
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.4
**C#**
``` C#

View file

@ -7,7 +7,7 @@ Initializes a new instance of the <a href="T_CapyKit_Helpers_EncryptionHelper.md
## Definition
**Namespace:** <a href="N_CapyKit_Helpers.md">CapyKit.Helpers</a>
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.2
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.4
**C#**
``` C#

View file

@ -7,7 +7,7 @@
## Definition
**Namespace:** <a href="N_CapyKit_Helpers.md">CapyKit.Helpers</a>
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.2
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.4
**C#**
``` C#

View file

@ -7,7 +7,7 @@
## Definition
**Namespace:** <a href="N_CapyKit_Helpers.md">CapyKit.Helpers</a>
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.2
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.4
**C#**
``` C#

View file

@ -0,0 +1,38 @@
# BytesToHex Method
Converts a byte array to a hex string.
## Definition
**Namespace:** <a href="N_CapyKit_Helpers.md">CapyKit.Helpers</a>
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.4
**C#**
``` C#
private string BytesToHex(
byte[] bytes
)
```
**F#**
``` F#
private member BytesToHex :
bytes : byte[] -> string
```
#### Parameters
<dl><dt>  <a href="https://learn.microsoft.com/dotnet/api/system.byte" target="_blank" rel="noopener noreferrer">Byte</a>[]</dt><dd>The bytes.</dd></dl>
#### Return Value
<a href="https://learn.microsoft.com/dotnet/api/system.string" target="_blank" rel="noopener noreferrer">String</a>
A string.
## See Also
#### Reference
<a href="T_CapyKit_Helpers_KeyHelper.md">KeyHelper Class</a>
<a href="N_CapyKit_Helpers.md">CapyKit.Helpers Namespace</a>

View file

@ -0,0 +1,38 @@
# ComputeSignature Method
Computes an HMAC-SHA256 over the salt using the master key and truncates it to the same number of bytes as the salt.
## Definition
**Namespace:** <a href="N_CapyKit_Helpers.md">CapyKit.Helpers</a>
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.4
**C#**
``` C#
private byte[] ComputeSignature(
byte[] salt
)
```
**F#**
``` F#
private member ComputeSignature :
salt : byte[] -> byte[]
```
#### Parameters
<dl><dt>  <a href="https://learn.microsoft.com/dotnet/api/system.byte" target="_blank" rel="noopener noreferrer">Byte</a>[]</dt><dd>The salt.</dd></dl>
#### Return Value
<a href="https://learn.microsoft.com/dotnet/api/system.byte" target="_blank" rel="noopener noreferrer">Byte</a>[]
The calculated signature.
## See Also
#### Reference
<a href="T_CapyKit_Helpers_KeyHelper.md">KeyHelper Class</a>
<a href="N_CapyKit_Helpers.md">CapyKit.Helpers Namespace</a>

View file

@ -0,0 +1,38 @@
# FormatKey Method
Formats the given hex string into the desired number of parts (separated by dashes).
## Definition
**Namespace:** <a href="N_CapyKit_Helpers.md">CapyKit.Helpers</a>
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.4
**C#**
``` C#
private string FormatKey(
string hex
)
```
**F#**
``` F#
private member FormatKey :
hex : string -> string
```
#### Parameters
<dl><dt>  <a href="https://learn.microsoft.com/dotnet/api/system.string" target="_blank" rel="noopener noreferrer">String</a></dt><dd>The hexadecimal.</dd></dl>
#### Return Value
<a href="https://learn.microsoft.com/dotnet/api/system.string" target="_blank" rel="noopener noreferrer">String</a>
The formatted key.
## See Also
#### Reference
<a href="T_CapyKit_Helpers_KeyHelper.md">KeyHelper Class</a>
<a href="N_CapyKit_Helpers.md">CapyKit.Helpers Namespace</a>

View file

@ -0,0 +1,32 @@
# GenerateKey Method
Generates a random key.
## Definition
**Namespace:** <a href="N_CapyKit_Helpers.md">CapyKit.Helpers</a>
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.4
**C#**
``` C#
public string GenerateKey()
```
**F#**
``` F#
member GenerateKey : unit -> string
```
#### Return Value
<a href="https://learn.microsoft.com/dotnet/api/system.string" target="_blank" rel="noopener noreferrer">String</a>
The key.
## See Also
#### Reference
<a href="T_CapyKit_Helpers_KeyHelper.md">KeyHelper Class</a>
<a href="N_CapyKit_Helpers.md">CapyKit.Helpers Namespace</a>

View file

@ -0,0 +1,39 @@
# GetMasterKey Method
Gets the master key.
## Definition
**Namespace:** <a href="N_CapyKit_Helpers.md">CapyKit.Helpers</a>
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.4
**C#**
``` C#
public byte[] GetMasterKey()
```
**F#**
``` F#
member GetMasterKey : unit -> byte[]
```
#### Return Value
<a href="https://learn.microsoft.com/dotnet/api/system.byte" target="_blank" rel="noopener noreferrer">Byte</a>[]
An array of byte.
## Exceptions
<table>
<tr>
<td><a href="https://learn.microsoft.com/dotnet/api/system.invalidoperationexception" target="_blank" rel="noopener noreferrer">InvalidOperationException</a></td>
<td>Thrown when the requested operation is invalid.</td></tr>
</table>
## See Also
#### Reference
<a href="T_CapyKit_Helpers_KeyHelper.md">KeyHelper Class</a>
<a href="N_CapyKit_Helpers.md">CapyKit.Helpers Namespace</a>

View file

@ -0,0 +1,39 @@
# GetNumParts Method
Gets the number parts.
## Definition
**Namespace:** <a href="N_CapyKit_Helpers.md">CapyKit.Helpers</a>
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.4
**C#**
``` C#
public int GetNumParts()
```
**F#**
``` F#
member GetNumParts : unit -> int
```
#### Return Value
<a href="https://learn.microsoft.com/dotnet/api/system.int32" target="_blank" rel="noopener noreferrer">Int32</a>
The number parts.
## Exceptions
<table>
<tr>
<td><a href="https://learn.microsoft.com/dotnet/api/system.argumentexception" target="_blank" rel="noopener noreferrer">ArgumentException</a></td>
<td>Thrown when one or more arguments have unsupported or illegal values.</td></tr>
</table>
## See Also
#### Reference
<a href="T_CapyKit_Helpers_KeyHelper.md">KeyHelper Class</a>
<a href="N_CapyKit_Helpers.md">CapyKit.Helpers Namespace</a>

View file

@ -0,0 +1,32 @@
# GetSaltSize Method
Gets the salt size.
## Definition
**Namespace:** <a href="N_CapyKit_Helpers.md">CapyKit.Helpers</a>
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.4
**C#**
``` C#
public int GetSaltSize()
```
**F#**
``` F#
member GetSaltSize : unit -> int
```
#### Return Value
<a href="https://learn.microsoft.com/dotnet/api/system.int32" target="_blank" rel="noopener noreferrer">Int32</a>
The salt size.
## See Also
#### Reference
<a href="T_CapyKit_Helpers_KeyHelper.md">KeyHelper Class</a>
<a href="N_CapyKit_Helpers.md">CapyKit.Helpers Namespace</a>

View file

@ -0,0 +1,45 @@
# HexToBytes Method
Converts a hex string back to a byte array.
## Definition
**Namespace:** <a href="N_CapyKit_Helpers.md">CapyKit.Helpers</a>
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.4
**C#**
``` C#
private byte[] HexToBytes(
string hex
)
```
**F#**
``` F#
private member HexToBytes :
hex : string -> byte[]
```
#### Parameters
<dl><dt>  <a href="https://learn.microsoft.com/dotnet/api/system.string" target="_blank" rel="noopener noreferrer">String</a></dt><dd>The hexadecimal.</dd></dl>
#### Return Value
<a href="https://learn.microsoft.com/dotnet/api/system.byte" target="_blank" rel="noopener noreferrer">Byte</a>[]
A byte[].
## Exceptions
<table>
<tr>
<td><a href="https://learn.microsoft.com/dotnet/api/system.argumentexception" target="_blank" rel="noopener noreferrer">ArgumentException</a></td>
<td>Thrown when one or more arguments have unsupported or illegal values.</td></tr>
</table>
## See Also
#### Reference
<a href="T_CapyKit_Helpers_KeyHelper.md">KeyHelper Class</a>
<a href="N_CapyKit_Helpers.md">CapyKit.Helpers Namespace</a>

View file

@ -0,0 +1,34 @@
# SetMasterKeyAccessor Method
Sets the master key.
## Definition
**Namespace:** <a href="N_CapyKit_Helpers.md">CapyKit.Helpers</a>
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.4
**C#**
``` C#
public void SetMasterKeyAccessor(
Func<byte[]> accessor
)
```
**F#**
``` F#
member SetMasterKeyAccessor :
accessor : Func<byte[]> -> unit
```
#### Parameters
<dl><dt>  <a href="https://learn.microsoft.com/dotnet/api/system.func-1" target="_blank" rel="noopener noreferrer">Func</a>(<a href="https://learn.microsoft.com/dotnet/api/system.byte" target="_blank" rel="noopener noreferrer">Byte</a>[])</dt><dd>The accessor function.</dd></dl>
## See Also
#### Reference
<a href="T_CapyKit_Helpers_KeyHelper.md">KeyHelper Class</a>
<a href="N_CapyKit_Helpers.md">CapyKit.Helpers Namespace</a>

View file

@ -0,0 +1,34 @@
# SetNumPartsAccessor Method
Set and get the number of parts for the formatted key. Default is 2.
## Definition
**Namespace:** <a href="N_CapyKit_Helpers.md">CapyKit.Helpers</a>
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.4
**C#**
``` C#
public void SetNumPartsAccessor(
Func<int> accessor
)
```
**F#**
``` F#
member SetNumPartsAccessor :
accessor : Func<int> -> unit
```
#### Parameters
<dl><dt>  <a href="https://learn.microsoft.com/dotnet/api/system.func-1" target="_blank" rel="noopener noreferrer">Func</a>(<a href="https://learn.microsoft.com/dotnet/api/system.int32" target="_blank" rel="noopener noreferrer">Int32</a>)</dt><dd>The accessor function.</dd></dl>
## See Also
#### Reference
<a href="T_CapyKit_Helpers_KeyHelper.md">KeyHelper Class</a>
<a href="N_CapyKit_Helpers.md">CapyKit.Helpers Namespace</a>

View file

@ -0,0 +1,34 @@
# SetSaltSizeAccessor Method
Sets the salt size (in bytes). Default is 4.
## Definition
**Namespace:** <a href="N_CapyKit_Helpers.md">CapyKit.Helpers</a>
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.4
**C#**
``` C#
public void SetSaltSizeAccessor(
Func<int> accessor
)
```
**F#**
``` F#
member SetSaltSizeAccessor :
accessor : Func<int> -> unit
```
#### Parameters
<dl><dt>  <a href="https://learn.microsoft.com/dotnet/api/system.func-1" target="_blank" rel="noopener noreferrer">Func</a>(<a href="https://learn.microsoft.com/dotnet/api/system.int32" target="_blank" rel="noopener noreferrer">Int32</a>)</dt><dd>The accessor function.</dd></dl>
## See Also
#### Reference
<a href="T_CapyKit_Helpers_KeyHelper.md">KeyHelper Class</a>
<a href="N_CapyKit_Helpers.md">CapyKit.Helpers Namespace</a>

View file

@ -0,0 +1,41 @@
# ValidateKey Method
Validates the provided key.
## Definition
**Namespace:** <a href="N_CapyKit_Helpers.md">CapyKit.Helpers</a>
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.4
**C#**
``` C#
public bool ValidateKey(
string providedKey
)
```
**F#**
``` F#
member ValidateKey :
providedKey : string -> bool
```
#### Parameters
<dl><dt>  <a href="https://learn.microsoft.com/dotnet/api/system.string" target="_blank" rel="noopener noreferrer">String</a></dt><dd>The provided key.</dd></dl>
#### Return Value
<a href="https://learn.microsoft.com/dotnet/api/system.boolean" target="_blank" rel="noopener noreferrer">Boolean</a>
True if it succeeds, false if it fails.
## See Also
#### Reference
<a href="T_CapyKit_Helpers_KeyHelper.md">KeyHelper Class</a>
<a href="N_CapyKit_Helpers.md">CapyKit.Helpers Namespace</a>
<a href="M_CapyKit_Helpers_KeyHelper_GetMasterKey.md">GetMasterKey()</a>
<a href="M_CapyKit_Helpers_KeyHelper_SetMasterKeyAccessor.md">SetMasterKeyAccessor(Func(Byte[]))</a>
<a href="F_CapyKit_Helpers_KeyHelper_masterKeyAccessor.md">masterKeyAccessor</a>

View file

@ -0,0 +1,28 @@
# KeyHelper Constructor
Initializes a new instance of the <a href="T_CapyKit_Helpers_KeyHelper.md">KeyHelper</a> class
## Definition
**Namespace:** <a href="N_CapyKit_Helpers.md">CapyKit.Helpers</a>
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.4
**C#**
``` C#
public KeyHelper()
```
**F#**
``` F#
new : unit -> KeyHelper
```
## See Also
#### Reference
<a href="T_CapyKit_Helpers_KeyHelper.md">KeyHelper Class</a>
<a href="N_CapyKit_Helpers.md">CapyKit.Helpers Namespace</a>

View file

@ -7,7 +7,7 @@ Converts camel case text to human readable text.
## Definition
**Namespace:** <a href="N_CapyKit_Helpers.md">CapyKit.Helpers</a>
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.2
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.4
**C#**
``` C#

View file

@ -7,7 +7,7 @@ Initializes a new instance of the <a href="T_CapyKit_Helpers_LanguageHelper.md">
## Definition
**Namespace:** <a href="N_CapyKit_Helpers.md">CapyKit.Helpers</a>
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.2
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.4
**C#**
``` C#

View file

@ -7,7 +7,7 @@ Compares an unencrypted *password* with a stored, encrypted *existingPassword*.
## Definition
**Namespace:** <a href="N_CapyKit_Helpers.md">CapyKit.Helpers</a>
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.2
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.4
**C#**
``` C#

View file

@ -7,7 +7,7 @@ Compares an unencrypted *password* with a stored, encrypted *existingPassword*.
## Definition
**Namespace:** <a href="N_CapyKit_Helpers.md">CapyKit.Helpers</a>
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.2
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.4
**C#**
``` C#

View file

@ -7,7 +7,7 @@ Compares two session identifiers.
## Definition
**Namespace:** <a href="N_CapyKit_Helpers.md">CapyKit.Helpers</a>
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.2
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.4
**C#**
``` C#

View file

@ -7,7 +7,7 @@ Compare two strings as case sensative.
## Definition
**Namespace:** <a href="N_CapyKit_Helpers.md">CapyKit.Helpers</a>
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.2
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.4
**C#**
``` C#

Some files were not shown because too many files have changed in this diff Show more