public int Hash() { hash = f(h0, Alphabet.GetCharCodeRSA(message[0])); foreach (var ch in message.Substring(1)) { hash = f(hash, Alphabet.GetCharCodeRSA(ch)); } return(hash); }
public string Encrypt() { foreach (var ch in message) { int charIndex = Alphabet.GetCharCodeRSA(ch); maxCharCode = charIndex > maxCharCode ? charIndex : maxCharCode; if (maxCharCode >= n) { throw new Exception($"Индекс буквы {Alphabet.GetCharRSA(maxCharCode)} = {maxCharCode} больше/равно n = {n}"); } var res = BigInteger.ModPow(charIndex, e, n); encryptedMessage += res + " "; } return(encryptedMessage); }