Galois Field implementation in javascript