コード例 #1
0
        public static byte[] ConcatenatedSaltAndSaltedHash(string passwordStr)
        {
            // hash password with salt.. still trying to understand a bit about the difference between unicode and base 64 string so for now we are just dealing with byte arrays
            byte[] salt         = HelperMethods.CreateSalt(HelperMethods.salt_length);
            byte[] password     = HelperMethods.GenerateSaltedHash(Encoding.UTF8.GetBytes(passwordStr), salt);
            byte[] concatenated = new byte[salt.Length + password.Length];
            Buffer.BlockCopy(salt, 0, concatenated, 0, salt.Length);
            Buffer.BlockCopy(password, 0, concatenated, salt.Length, password.Length);

            return(concatenated);
        }