0

I am passing a secret key (length of 16 ASCII chars = 128 bits) through Reed Solomon encoder which is operating over Galois field 16 (2^16).

My question is: should this key be considered as 128 bits or 256?

I got lost here because I know that ASCII character = 8 bits so 16 ASCII character = 128 bits.

I read an article where it says once you passed the key through GF(16) then it will be 256, not 128 and I should pass only a key with 8 ASCII character instead. is this correct? please see the function that I am using below where i used Matlab communication toolbox function code = errorCorrectingCode(data, LENGTH) % ERRORCORRECTINGCODE takes input data and runs it through Reed-Solomon Code % See the following link: % http://www.mathworks.com/help/comm/ref/encode.html % >>> example: rsdec(rsenc(gf([1 2 3 ; 4 5 6],3),7,3),7,3);

% Apply Reed-Solomon encoding operation to data to obtain ECCed code.

% convert to GF(2^16) elements:
% (two characters map to one element, so 16char = 8)
elements = keyToField(data);
msg = elements';

% create encoding:
code = rsenc(msg,LENGTH,length(msg));

end

function gfArray = keyToField(keystr)
% KEYTOFIELD takes a key string composed of N characters,
% converting every two characters to a field array in the
% field GF(2^16).

% define number of elements in gfArray as floor(N / 2):
numElts = floor(length(keystr) / 2);
% define flag that checks if keystr is odd or not:
oddLength = mod(length(keystr),2);

% initialize pre-output:
gfArray_bin = zeros((numElts + oddLength),16);

% loop thru pairs of chars in the key:
for idx=1:numElts
curr = 2 * idx;
gfArray_bin(idx,:) = [dec2bin(double(keystr(curr - 1)),8)       dec2bin(double(keystr(curr)),8)] - 48;
end

% take care of last element if odd:
if (oddLength)
gfArray_bin(end,:) = dec2bin(double(keystr(end)),16) - 48;
end

% convert everything to decimal again:
gfArray_dec = zeros(size(gfArray_bin,1),1);
for jdx=1:size(gfArray_bin,1)
% shorthand for current row:
bitrow = gfArray_bin(jdx,:);
% convert from a row of 1's and 0's to decimal representation:
gfArray_dec(jdx) = sum(bitrow .* 2.^(numel(bitrow)-1:-1:0));
end

% generate output by wrapping gfArray_dec in field array:
gfArray = gf(gfArray_dec,16);

end
  • https://stackoverflow.com/questions/15297809/sql-transpose-full-table : you can go over the Java implementation and see the length of the key in bits. I think that in this example it is 128 bits. – Rann Lifshitz Apr 22 '18 at 01:41
  • Assuming GF(65536) == GF(2^16), then the 16 Ascii characters could be considered as eight 16 bit symbols. You don't mention the generator polynomial or even it's degree, so how many symbols are being added to the key by RS encoding? Also not mentioned if this is an original view or BCH view RS code. See [wiki article](https://en.wikipedia.org/wiki/Reed%E2%80%93Solomon_error_correction) . – rcgldr Apr 22 '18 at 21:49
  • Hi, thanks for your help and feedback. I edited the question by adding the functions and i am using matlab. – user9680269 Apr 23 '18 at 04:11
  • @user9680269 - Since this is GF(2^16), I'm thinking the key remains at 128 bits, using eight 16 bit symbols. The link you provided only describes the encode as "cyclic", which would not necessarily mean Reed Solomon. – rcgldr Apr 24 '18 at 17:45
  • Hi, so now i can pass a key with 8 and deal with it as 128 bit in my case? Thanks – user9680269 Apr 24 '18 at 18:17

0 Answers0