CSharp examples for System:String Base
Encrypt a String
// Redistribution and use in source and binary forms, with or without modification, using System.Text; using System;/*from w ww. j ava 2s. c om*/ public class Main{ public static string Encrypt(string text) { string key = "123321Sc9FVpwerrw8RsdfZn"; StringBuilder result = new StringBuilder(); for (int c = 0; c < text.Length; c++) result.Append((char)((uint)text[c] ^ (uint)key[c % key.Length])); byte[] bytesToEncode = System.Text.Encoding.UTF8.GetBytes(result.ToString()); string encodedText = Convert.ToBase64String(bytesToEncode); return encodedText; } }