Reading a textfile and calling a class with each text file line
public static T[] CopySubArray&lt;T&gt;(this T[] source, int length, int offset = 0)
{
    T[] result = new T[length];
    while (--length &gt;= 0)
    {
        if (source.Length &gt; offset + length)
        {
            result[length] = source[offset + length];
        }
    }

    return result;
}



I wonder why did you write this method? You can replace it with Array.Copy that, strangely enough, you already use in another place and even the exact same overload:


Array.Copy(hash, 0, result, 0, 4);



Signature:

public static void Copy(
    Array sourceArray,
    int sourceIndex,
    Array destinationArray,
    int destinationIndex,
    int length
)





public static string GenerateHash(string email, byte[] passwordAesKey)



This method should only generate a hash and not an encoded string. Encoding the hash is a responsibility for a different method.




ToBase64



Likewise is this method doing too much. It not only creates a base64 string but also replaces some characters. This should moved to a new method like CleanUpBase64String or whatever it does. It can be private but this kind of custom processing should be encapsulated.



Basically this is how it should look like:

public static byte[] GenerateHash(string email, byte[] passwordAesKey)
{
    ..
}

public static string GenerateHashBase64String(string email, byte[] passwordAesKey)
{
    var hash = GenerateHash(email, passwordAesKey);
    return ToEncodedBase64(hash);
}

public static string ToEncodedBase64(this byte[] data)
{
    var base64String = Convert.ToBase64String(data)
    return CleanUpBase64String(base64String);
}

private static string CleanUpBase64String(string value)
{
    ...
}