Home » C# Programing

Encrypt and Decrypt Using Class

public string DecryptString(string encrString) {     byte[] b;     string decrypted;     try     {         b = Convert.FromBase64String(encrString);         decrypted = System.Text.ASCIIEncoding.ASCII.GetString(b);     }     catch (FormatException fe)     {         decrypted = “”;     }     return decrypted; } public string EnryptString(string strEncrypted) {     byte[] b = System.Text.ASCIIEncoding.ASCII.GetBytes(strEncrypted);     string encrypted = Convert.ToBase64String(b);     return encrypted; } Still The above code is not enough for me because I want to do something with my…

Read More »

Encrypt and Decrypt with Character Choice

public string encrypt(string encryptString) { string EncryptionKey = “0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ”; byte[] clearBytes = Encoding.Unicode.GetBytes(encryptString); using(Aes encryptor = Aes.Create()) { Rfc2898DeriveBytes pdb = new Rfc2898DeriveBytes(EncryptionKey, new byte[] { 0x49, 0x76, 0x61, 0x6e, 0x20, 0x4d, 0x65, 0x64, 0x76, 0x65, 0x64, 0x65,…

Read More »

Encrypting & Decrypting a String in C#

using System.IO; using System.Text; using System.Security.Cryptography; public static class EncryptionHelper { public static string Encrypt(string clearText) { string EncryptionKey = “abc123”; byte[] clearBytes = Encoding.Unicode.GetBytes(clearText); using (Aes encryptor = Aes.Create()) { Rfc2898DeriveBytes pdb = new Rfc2898DeriveBytes(EncryptionKey, new byte[]…

Read More »

Sale Price Calculator

// Gaddis Code from text with slight mods (Wyatt) // // Terry T Trainer CIS 202 3/22/2013 /* Calculates Sale Price of Item from Price and Discount %            get price –  must Parse!       get discount % -…

Read More »

c# calculate percentage example

double Rslt = disc – ((disc * Convert.ToDouble(txtdiscount.Text)) / 100);

Read More »

what is C# – Delegates

C# delegates are similar to pointers to functions, in C or C++. A delegate is a reference type variable that holds the reference to a method. The reference can be changed at runtime. Delegates are especially used for…

Read More »
Skip to toolbar