return bytes;
}
+ public static byte[] TrimArray(byte[] bytes)
+ {
+ int trimStart = bytes.Length - 1;
+ while (trimStart >= 0 && bytes[trimStart] == 0)
+ {
+ trimStart--;
+ }
+
+ byte[] result = new byte[trimStart + 1];
+ Array.Copy(bytes, 0, result, 0, trimStart + 1);
+
+ return result;
+ }
+
+ public static byte[] AppendWithZeros(byte[] bytes, int nTargetLen=32)
+ {
+ var result = new byte[nTargetLen];
+ bytes.CopyTo(result, 0);
+
+ return result;
+ }
+
public static string ToHex(byte[] bytes)
{
var sb = new StringBuilder();