title: Encrypting string to 15 characters
body: <p>I am doing this serial key thing where the format is xxxxx-xxxxx-xxxxx (15 characters).
  I can currently encrypt my string but the problems are:</p>
  
  <ol>
  <li>6 Characters become 20+ Characters.</li>
  <li>Has some underieable characters such as: +, /, =</li>
  </ol>
  
  <p>So what would be the best way to encrypt a string to certain number of characters?
  In my case: 6 characters encrypted to 15 characters. </p>
  
  <p>I am currently using something like this:</p>
  
  <pre><code>    public string EncryptString(string clearText, string Password)
      {
          byte[] clearBytes = System.Text.Encoding.Unicode.GetBytes(clearText);
          Rfc2898DeriveBytes pdb = new Rfc2898DeriveBytes(Password, ByteGetter(UsageMode, "Password")); 
          byte[] encryptedData = EncryptByte(clearBytes, pdb.GetBytes(32), pdb.GetBytes(16));
          return Convert.ToBase64String(encryptedData);
      }
  
  
      public static byte[] EncryptByte(byte[] clearData, byte[] Key, byte[] IV)
      {
          MemoryStream ms = new MemoryStream();
          Rijndael alg = Rijndael.Create();
          alg.Key = Key;
          alg.IV = IV;
          CryptoStream cs = new CryptoStream(ms, alg.CreateEncryptor(), CryptoStreamMode.Write);
          cs.Write(clearData, 0, clearData.Length);
          cs.Close();
          byte[] encryptedData = ms.ToArray();
          return encryptedData;
      }
  </code></pre>