Argentini.Halide.H3Secure.CreateBaseKey C# (CSharp) Метод

CreateBaseKey() публичный статический Метод

Converts a comma-separated string of 24 8-bit values and converts it into a Byte array.
public static CreateBaseKey ( String key ) : Byte[]
key String 32 8-bit values in a comma-separated list.
Результат Byte[]
        public static Byte[] CreateBaseKey(String key)
        {
            Byte[] retVal = { };
            int bitLength = 32;

            try
            {
                if (!String.IsNullOrEmpty(key))
                {
                    String[] bArray = key.Replace(" ", "").Split(',');

                    if (bArray.Length == bitLength)
                    {
                        retVal = new Byte[bitLength];

                        for (Int32 x = 0; x < bArray.Length; x++)
                        {
                            retVal[x] = Convert.ToByte(bArray[x].Trim());
                        }
                    }
                }
            }

            catch (Exception err)
            {
                throw new Exception("Halide.H3Secure Error: " + err.ToString());
            }

            return retVal;
        }