internal static EInteger WordsToEInteger(int[] words)
{
int wordCount = words.Length;
if (wordCount == 1 && (words[0] >> 31) == 0) {
return (EInteger)((int)words[0]);
}
var bytes = new byte[(wordCount * 4) + 1];
for (var i = 0; i < wordCount; ++i) {
bytes[(i * 4) + 0] = (byte)(words[i] & 0xff);
bytes[(i * 4) + 1] = (byte)((words[i] >> 8) & 0xff);
bytes[(i * 4) + 2] = (byte)((words[i] >> 16) & 0xff);
bytes[(i * 4) + 3] = (byte)((words[i] >> 24) & 0xff);
}
bytes[bytes.Length - 1] = (byte)0;
return EInteger.FromBytes(bytes, true);
}