module

CrImage::Util::QRCode::GaloisField

Galois Field GF(2^8) arithmetic for Reed-Solomon encoding

Constants

ANTILOG = begin antilog = Array(Int32).new(256, 0) x = 1 256.times do |i| antilog[i] = x x = x << 1 if x >= 256 x = x ^ PRIMITIVE end end antilog end
LOG = begin log = Array(Int32).new(256, 0) antilog = Array(Int32).new(256, 0) x = 1 256.times do |i| antilog[i] = x if i < 255 log[x] = i end x = x << 1 if x >= 256 x = x ^ PRIMITIVE end end log[1] = 0 log end

Pre-computed log and antilog tables

PRIMITIVE = 285

Generator polynomial: x^8 + x^4 + x^3 + x^2 + 1 (0x11d)

Class methods

divide(a : Int32, b : Int32) : Int32
Source
multiply(a : Int32, b : Int32) : Int32
Source
power(a : Int32, n : Int32) : Int32
Source