public void CalculateKeyFromText(string a_text, string a_key)
 {
     if (HashFunction is ICrypto)
     {
         IHMAC hmac = HashFactory.HMAC.CreateHMAC(HashFunction);
         hmac.Key = Converters.ConvertStringToBytes(a_key, Encoding.ASCII);
         Hash     = hmac.ComputeString(a_text, Encoding.ASCII).ToString();
     }
     else if (HashFunction is IWithKey)
     {
         IWithKey hash_with_key = HashFunction as IWithKey;
         try
         {
             var key_bytes = Converters.ConvertStringToBytes(a_key, Encoding.ASCII);
             if (key_bytes.Length == 0)
             {
                 key_bytes = null;
             }
             hash_with_key.Key = key_bytes;
             Hash = hash_with_key.ComputeString(a_text, Encoding.ASCII).ToString();
         }
         catch
         {
             Hash = "Error";
         }
     }
     else
     {
         Debug.Assert(false);
     }
 }