public void BigIntShouldSubtractBySumCorrectly(string first, string second, string expected) { var sum = new BigInt(first) + new BigInt(second); Assert.AreEqual(expected, sum.ToString()); }
private List <string> RSAEncode(string s, BigInt e, BigInt n) { var res = new List <string>(); var b = new BigInt(); for (var i = 0; i < s.Length; i++) { var index = Array.IndexOf(characters, s[i]); b = new BigInt(index.ToString()); b = b.Pow(e); b = b % n; res.Add(b.ToString()); } return(res); }
private string RSADecode(List <string> encodeRes, BigInt d, BigInt n) { var res = ""; foreach (var e in encodeRes) { var b = new BigInt(e); b = b.Pow(d); b = b % n; var index = Convert.ToInt32(b.ToString()); res += characters[index].ToString(); } return(res); }
public void BigIntOverLongShouldSumCorrectly(long a, long b, string expected) { var actual = new BigInt(a.ToString()) + new BigInt(b.ToString()); Assert.AreEqual(expected, actual.ToString()); }
public void BigIntShouldGetRightToString(long value) { var integer = new BigInt(value.ToString()); Assert.AreEqual(value.ToString(), integer.ToString()); }
public void BigIntToStringCorrectly(string value) { var integer = new BigInt(value); Assert.AreEqual(value, integer.ToString()); }
public void BigIntShouldDivCorrectly(string first, string second, string expected) { var div = new BigInt(first) / new BigInt(second); Assert.AreEqual(expected, div.ToString()); }
public void BigIntShouldSubtractCorrectly(string first, string second, string expected) { var sub = new BigInt(first) - new BigInt(second); Assert.AreEqual(sub.ToString(), expected); }