Ejemplo n.º 1
0
        //inserts all
        public void OneInsertEach()
        {
            HashingEntitiesConn context = new HashingEntitiesConn();

            context.Database.Log += Console.WriteLine;
            try
            {
                context.Configuration.AutoDetectChangesEnabled = false;

                foreach (string password in arrangements)
                {
                    Console.WriteLine(password);

                    string md5hash  = HashesClass.computeHash(password, "MD5");
                    string sha1hash = HashesClass.computeHash(password, "SHA1");
                    string sha2hash = HashesClass.computeHash(password, "SHA256");

                    var rainbow = new Rainbow()
                    {
                        password = password,
                        md5hash  = md5hash,
                        sha1hash = sha1hash,
                        sha2hash = sha2hash
                    };
                    context.Rainbows.Add(rainbow);
                    //context.SaveChanges();
                }

                context.SaveChanges();
            }
            finally
            {
                context.Configuration.AutoDetectChangesEnabled = true;
            }
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            Insertions ins = new Insertions(3);


            PerformanceMeasurements.RunWithMeasures(ins.LoadIntoDatabase, Insertions.Loading.InsertSome);
            Stopwatch watch = new Stopwatch();

            watch.Start();
            Console.WriteLine(HashesClass.ReverseHash("79a5d99c57bc9556dc76d3605f103e66", "MD5"));
            watch.Stop();
            Console.ReadLine();
        }
Ejemplo n.º 3
0
        public void AddRange()
        {
            HashingEntitiesConn context = null;

            try
            {
                context = new HashingEntitiesConn();
                context.Database.Log += Console.WriteLine;
                context.Configuration.AutoDetectChangesEnabled = false;
                List <Rainbow> rainbows = new List <Rainbow>();

                foreach (string password in arrangements)
                {
                    string md5hash  = HashesClass.computeHash(password, "MD5");
                    string sha1hash = HashesClass.computeHash(password, "SHA1");
                    string sha2hash = HashesClass.computeHash(password, "SHA256");

                    rainbows.Add(new Rainbow()
                    {
                        password = password,
                        md5hash  = md5hash,
                        sha1hash = sha1hash,
                        sha2hash = sha2hash
                    });
                }

                Console.WriteLine("finished loading");

                context.Rainbows.AddRange(rainbows);
                context.SaveChanges();
            }
            finally
            {
                if (context != null)
                {
                    context.Dispose();
                }
            }
        }