예제 #1
0
        /// <summary>
        /// Create SHA2 hash
        /// </summary>
        /// <param name="phrase"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        public static string CreateShaHash(string[] phrase, Constants.TypeConvertMD5 type)
        {
            var hashTool = new SHA512Managed();
            var phraseAsByte = Encoding.UTF8.GetBytes(string.Concat(phrase));
            var encryptedBytes = hashTool.ComputeHash(phraseAsByte);
            hashTool.Clear();

            var data = "";

            switch (type)
            {
                case Constants.TypeConvertMD5.Bit:
                    data = BitConverter.ToString(encryptedBytes);
                    break;
                case Constants.TypeConvertMD5.String:
                    data = Convert.ToBase64String(encryptedBytes);
                    break;
            }

            return data;
        }
 public TubeJourneyPlanner()
 {
     this.matrix = new MatrixFactory().CreateMatrix();
     this.stationHelper = new Constants();
     this.routeCalculator = new RouteCalculator(this.matrix, this.stationHelper);
 }
 public TubeJourneyPlanner(Station[,] matrix, Constants stationHelper, RouteCalculator routeCalculator)
 {
     this.matrix = matrix;
     this.stationHelper = stationHelper;
     this.routeCalculator = routeCalculator;
 }