Class Encryption

A simple encryption class that can be used to two-way encode/decode strings and byte buffers with single method calls.

public class Encryption : object

Class Members




Replace this value with some unique key of your own Best set this in your App start up in a Static constructor


Generates a hash for the given plain text value and returns a base64-encoded result. Before the hash is computed, a random salt is generated and appended to the plain text. This salt is stored at the end of the hash value, so it can be used later for hash verification.

public static string ComputeHash(string plainText,     string hashAlgorithm,     Byte[] saltBytes)


Decrypts a Byte array from DES with an Encryption Key.

public static Byte[] DecryptBytes(Byte[] DecryptBuffer,     string EncryptionKey)

public static Byte[] DecryptBytes(string DecryptString,     string EncryptionKey)


Decrypts a string using DES encryption and a pass key that was used for encryption.

public static string DecryptString(string DecryptString,     string EncryptionKey)


Encodes a stream of bytes using DES encryption with a pass key. Lowest level method that handles all work.

public static Byte[] EncryptBytes(Byte[] InputString,     string EncryptionKey)

public static Byte[] EncryptBytes(string DecryptString,     string EncryptionKey)


Encrypts a string using Triple DES encryption with a two way encryption key.String is returned as Base64 encoded value rather than binary.

public static string EncryptString(string InputString,     string EncryptionKey)


Encodes one file to another file that is gzip compressed. File is overwritten if it exists and not locked.

public static bool GZipFile(string Filename,     string OutputFile)


GZip encodes a memory buffer to a compressed memory buffer

public static Byte[] GZipMemory(Byte[] Buffer)

public static Byte[] GZipMemory(string Input)

public static Byte[] GZipMemory(string Filename,     bool IsFile)


Namespace: Westwind.Utilities
Assembly: westwind.utilities.dll

© West Wind Technologies, 1996-2016 • Updated: 12/12/15
Comment or report problem with topic