Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Implementation of Galois field arithmetic [closed]

Do you know of an implementation of Galois field arithmetic in C++? At least cases like GF(216) and GF(232) should be covered. Performance is a concern, so the implementation should have given some thought to optimizing its operations.

I'd prefer a common computational library or a small library dedicated to this task alone. Lacking these, I'd also welcome some readable source code.

like image 784
MvG Avatar asked Dec 12 '12 06:12

MvG


2 Answers

I found a link to a Galois Field Arithmetic Library by Arash Partow in the Wikipedia article on Finite field arithmetic.

At first glance, the code looks almost completely without comments, but written in a structured and therefore presumably understandable way. Performance doesn't appear to be an important design criterion, though: use of inlined functions is rather limited, and in general it appears like a direct notation of the theoretic math was deemed more important than expliting computational shortcuts. I list this here for completeness, so that you can have a look, form your own opinion, and can vote or comment accordingly.

like image 181
MvG Avatar answered Sep 19 '22 21:09

MvG


Perhaps you can use the code that implements GCM Mode in crypto++ (in particular, gcm.cpp). Crypto++ is a free C++ library implementing many crypto schemes. Among them is GCM which uses Galois Field arithmetic.

According to the license, the library itself is copyrighted, while the individual source files are public domain.

like image 42
jxh Avatar answered Sep 19 '22 21:09

jxh