Sphyrnidae Common Library  2.0.1
Shared Utilities/Library
Sphyrnidae.Common.Encryption.EncryptionExtensions Class Reference

Encrypts or decrypts a string. This utilizes IEncryption More...

Static Public Member Functions

static byte[] Hash (this string str, IEncryption encryption, string salt)
 Performs hashing (1-way encryption) against the string using the given salt More...
 
static bool EqualsHash (this string str, IEncryption encryption, string salt, byte[] hash)
 Hashes a string and then compares it to what is already known (eg. Does password match?) More...
 
static string Encrypt (this string str, IEncryption encryption)
 Encrypts the given string More...
 
static DecryptionResponse Decrypt (this string str, IEncryption encryption)
 Decrypts the given string More...
 

Detailed Description

Encrypts or decrypts a string. This utilizes IEncryption

Member Function Documentation

◆ Decrypt()

static DecryptionResponse Sphyrnidae.Common.Encryption.EncryptionExtensions.Decrypt ( this string  str,
IEncryption  encryption 
)
static

Decrypts the given string

Parameters
strThe string to decrypt
encryptionThe instance of the IEncryption interface

Note that decryption failures may throw an exception, or just return null value

Returns
A response object containing the decrypted value, and if the encrypted value is "current" - eg. if there is a new method/key

◆ Encrypt()

static string Sphyrnidae.Common.Encryption.EncryptionExtensions.Encrypt ( this string  str,
IEncryption  encryption 
)
static

Encrypts the given string

Parameters
strThe string to encrypt
encryptionThe instance of the IEncryption interface

Note that encryption failures may throw an exception, or just return null

Returns
The encrypted string

◆ EqualsHash()

static bool Sphyrnidae.Common.Encryption.EncryptionExtensions.EqualsHash ( this string  str,
IEncryption  encryption,
string  salt,
byte[]  hash 
)
static

Hashes a string and then compares it to what is already known (eg. Does password match?)

Parameters
strThe string to 1-way encrypt
encryptionThe instance of the IEncryption interface
saltA non-private/secure string used in the encryption process
hashThe existing bytes to be compared to
Returns
True if the match, false otherwise

◆ Hash()

static byte [] Sphyrnidae.Common.Encryption.EncryptionExtensions.Hash ( this string  str,
IEncryption  encryption,
string  salt 
)
static

Performs hashing (1-way encryption) against the string using the given salt

Parameters
strThe string to 1-way encrypt
encryptionThe instance of the IEncryption interface
saltA non-private/secure string used in the encryption process
Returns
The hashed bytes (currently 128 bytes long)

The documentation for this class was generated from the following file: