Esempio n. 1
0
        public static List <MyBigInteger> Encode(IEnumerable <int> bytes, MyBigInteger e, MyBigInteger module)
        {
            var result = new List <MyBigInteger>();

            foreach (var b in bytes)
            {
                var integer = MyBigInteger.ModPow(new MyBigInteger(b.ToString()), e, module);
                result.Add(integer);
            }
            return(result);
        }
Esempio n. 2
0
        public static int[] Decode(List <MyBigInteger> integers, MyBigInteger d, MyBigInteger module)
        {
            var result = new List <int>();

            foreach (var integer in integers)
            {
                var code = MyBigInteger.ModPow(integer, d, module);
                result.Add(int.Parse(code.ToString()));
            }
            return(result.ToArray());
        }