Siticone Humanizer Long
The SiticoneHumanizerLong is an advanced component designed for converting 64-bit integers (long) into words.
Unlike standard humanizers, it includes enterprise-grade security features such as AES-256 encryption, data integrity validation, and asynchronous processing capabilities.
It is ideal for financial applications, secure logging, or any scenario requiring the conversion of large numerical values with data protection.
Core Data
The primary properties for inputting 64-bit integers and retrieving the converted text.
| Property | Type | Description & Usage Example |
|---|---|---|
Value |
long |
humanizer.Value = 9223372036854775807;
The 64-bit integer to convert. Supports the full range of long.MinValue to long.MaxValue.
|
Words |
string |
string text = humanizer.Words;
Read-Only. Returns the converted text representation. Updated automatically when Value changes.
|
Security & Encryption
Built-in AES-256 encryption and hashing for secure data handling.
| Property/Method | Type | Description & Usage Example |
|---|---|---|
UseAESEncryption |
bool | humanizer.UseAESEncryption = true; Enables AES-256 encryption for internal processing. Required for generating encrypted outputs. |
RotateEncryptionKeys() |
Method |
humanizer.RotateEncryptionKeys(true);
Securely regenerates the internal encryption keys and IVs. Triggers the OnEncryptionKeyRotated event.
|
GetEncryptedValue() |
Method |
string secure = humanizer.GetEncryptedValue();
Returns a Base64 string containing the encrypted Value and Words, salted for security.
|
ValidateIntegrity() |
Method | bool isValid = humanizer.ValidateIntegrity(hash); Verifies that the current data matches a previously generated SHA-512 integrity hash. |
Performance & Async
Features for handling high-volume conversions without blocking the UI thread.
| Property/Method | Type | Description & Usage Example |
|---|---|---|
ConvertToWordsAsync() |
Task<string> | await humanizer.ConvertToWordsAsync(12345); Asynchronously converts a number to words, utilizing the thread pool to avoid freezing the application. |
EnableCaching |
bool | humanizer.EnableCaching = true; Stores conversion results in a concurrent dictionary to speed up repeated requests for the same number. |
MaxCacheSize |
int | humanizer.MaxCacheSize = 5000; Limits the memory usage of the cache. Older entries are trimmed automatically. |
Formatting Options
Customize the output style for readability and localization.
| Property | Type | Description & Usage Example |
|---|---|---|
UseOrdinalNumbers |
bool | humanizer.UseOrdinalNumbers = true; Converts the result to an ordinal rank (e.g., "one" becomes "first", "twenty" becomes "twentieth"). |
CapitalizeFirst |
bool | humanizer.CapitalizeFirst = true; Capitalizes the first letter of the generated string (e.g., "One hundred" instead of "one hundred"). |
CustomSeparator |
string | humanizer.CustomSeparator = "plus"; Replaces the standard "and" separator in compound numbers with a custom string. |
Culture |
CultureInfo | humanizer.Culture = new CultureInfo("en-GB"); Sets the cultural context for number formatting. |
Events
Hooks for monitoring changes and security events.
// Fires when the number is updated and converted
humanizer.OnNumbersChanged += (s, e) =>
{
Console.WriteLine($"Value: {e.Number}, Words: {e.Words}");
};
// Fires when encryption keys are rotated
humanizer.OnEncryptionKeyRotated += (s, e) =>
{
Console.WriteLine($"Key rotated at: {e.RotationTimestamp}");
Console.WriteLine($"New Key Hash: {e.KeyHash}");
};
Designer & Smart Tags
The component offers a comprehensive Smart Tag panel in Visual Studio for rapid configuration.
| Feature Category | Capabilities |
|---|---|
Value Presets |
Instantly set `Value` to: Zero, Million, Billion, Negative, or Max Value (long.MaxValue). |
Security Actions |
Rotate Encryption Key: Manually trigger key rotation. Validate Integrity: Check internal data consistency. View Encrypted Value: Preview the Base64 encrypted string. |
Style Presets |
One-click presets:
|
Detailed Usage Examples
Example 1: Secure Financial Transaction Logging
Convert transaction amounts to words and generate a secure signature for logging.
private void LogSecureTransaction(long amount)
{
humanizer.Value = amount;
humanizer.UseAESEncryption = true;
humanizer.CapitalizeFirst = true;
// Get conversion
string textAmount = humanizer.Words;
// Generate a signed encrypted packet
var (encryptedData, signature) = humanizer.GetSignedEncryptedValue();
Logger.Log($"Transaction: {textAmount}");
Logger.LogSecure(encryptedData, signature);
// Rotate keys after sensitive operation
humanizer.RotateEncryptionKeys();
}
Example 2: Async Processing for High Volume
Process a list of large numbers asynchronously to prevent UI freezing.
private async Task ProcessBatchAsync(List<long> numbers)
{
humanizer.EnableCaching = true; // Enable cache for performance
foreach (var num in numbers)
{
// Convert asynchronously
string word = await humanizer.ConvertToWordsAsync(num);
// Update UI safely
lbResults.Items.Add($"ID {num}: {word}");
}
}
Example 3: Ordinal Rankings
Displaying rank positions (e.g., "21st") for a leaderboard.
private void DisplayRank(long position)
{
humanizer.Value = position;
humanizer.UseOrdinalNumbers = true;
humanizer.CapitalizeFirst = true;
// Output Example (21): "Twenty-first"
lblRank.Text = $"You finished in {humanizer.Words} place!";
}