Exemple #1
0
        private static string Inicjaly(List <string> data)
        {
            string stringdata = ToString(data);

            using (MD5 Hashfunction = MD5.Create())
            {
                string hash = Hashfun.GetMd5Hash(Hashfunction, stringdata);
                data.Insert(0, "Plik zostal stworzony przez program ebibliotekarz. MD5=" + hash);
            }
            return(ToString(data));
        }
Exemple #2
0
        public static bool Sprawdzenie(List <string> data)
        {
            string[] splitter  = { "MD5=" };
            string[] temp      = data[0].Split(splitter, StringSplitOptions.None);
            string   hashcheck = "";

            try
            {
                hashcheck = temp[1];
            }
            catch
            {
                return(false);
            }
            data.RemoveAt(0);
            data.RemoveAt(data.Count - 1);
            using (MD5 Hashfunction = MD5.Create())
            {
                string hash = Hashfun.GetMd5Hash(Hashfunction, ToString(data));
                return(Hashfun.VerifyMd5Hash(Hashfunction, ToString(data), hashcheck));
            }
        }