public static int CalculateChecksum(string text) { if (text == null) throw new ArgumentNullException("text", "Cannot calculate checksum for null string."); int checksum = 0; foreach (char c in text) { checksum += c; } return checksum; }