Example #1
0
        public static List <Integer> Encode(IEnumerable <int> bytes, Integer e, Integer module)
        {
            var result = new List <Integer>();

            foreach (var b in bytes)
            {
                var integer = Integer.ModPow(new Integer(b.ToString()), e, module);
                result.Add(integer);
            }

            return(result);
        }
Example #2
0
        public static IEnumerable <int> Decode(IEnumerable <Integer> integers, Integer d, Integer module)
        {
            var result = new List <int>();

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

            return(result.ToArray());
        }