private HashAlgorithm GetHash (object halg)
{
if (halg == null)
throw new ArgumentNullException ("halg");
HashAlgorithm hash = null;
if (halg is String)
hash = HashAlgorithm.Create ((String)halg);
else if (halg is HashAlgorithm)
hash = (HashAlgorithm) halg;
else if (halg is Type)
hash = (HashAlgorithm) Activator.CreateInstance ((Type)halg);
else
throw new ArgumentException ("halg");
return hash;
}