Class Encryption

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

System.Object
  Westwind.Utilities.Encryption
public class Encryption : object

Class Members

MemberDescription

Constructor

Key

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

ComputeHash

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)

DecryptBytes

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)

DecryptString

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

public static string DecryptString(string DecryptString,     string EncryptionKey)

EncryptBytes

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)

EncryptString

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)

GZipFile

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)

GZipMemory

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)

Requirements

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

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