Class Cryptography
Provides methods for cryptographic operations, including hashing and encryption.
Inherited Members
Namespace: Innovt.Core.Utilities
Assembly: Innovt.Core.dll
Syntax
public static class Cryptography
Methods
| Edit this page View SourceAesDecrypt(string, string)
Decrypts an encrypted string using the AES algorithm with a specified key. Expects the IV to be prepended to the ciphertext (separated by colon).
Declaration
public static string AesDecrypt(string encryptedText, string keyString)
Parameters
| Type | Name | Description |
|---|---|---|
| string | encryptedText | The encrypted string with IV prepended. |
| string | keyString | The key for AES decryption. |
Returns
| Type | Description |
|---|---|
| string | The decrypted plaintext string. |
AesEncrypt(string, string)
Encrypts a plaintext string using the AES algorithm with a specified key. The IV (Initialization Vector) is randomly generated and prepended to the ciphertext.
Declaration
public static string AesEncrypt(string plainText, string keyString)
Parameters
| Type | Name | Description |
|---|---|---|
| string | plainText | The plaintext string to be encrypted. |
| string | keyString | The key for AES encryption. |
Returns
| Type | Description |
|---|---|
| string | The encrypted string with the IV prepended. |
Sha(string, string)
Declaration
public static string Sha(this string text, string salt = "")
Parameters
| Type | Name | Description |
|---|---|---|
| string | text | |
| string | salt |
Returns
| Type | Description |
|---|---|
| string |
ShaHash(string, string)
Computes the SHA-256 hash of a given plaintext password with an optional salt.
Declaration
public static string ShaHash(this string text, string salt = "")
Parameters
| Type | Name | Description |
|---|---|---|
| string | text | The plaintext password to be hashed. |
| string | salt | An optional salt value to add to the plaintext before hashing. |
Returns
| Type | Description |
|---|---|
| string | The SHA-256 hash of the plaintext password. |