The question sounds confusing I suppose, trying to make it more clear.
I'd like to implement a specifing non-leaking map with java card and according to the pseudocode I have, I should implement something like this:
JCArrayInt[] f = new JCArrayInt[2];
f[0] = new JCArrayInt(size);
f[1] = new JCArrayInt(size);
byte[] r = new byte[6];
byte[] help = new byte[6];
help = bit_and(r, 0x000000000001);
return f[help[5]].jcint;
Basically JCArrayInt is acting as twodimensional array consisting of two byte-arrays of size 6 (48 bit unsigned integer).
All I want to do for the bitwise and is to "and" the byte-array r with the constant 0x00...1
and if the result is 1 I am continuing with the bytearray at f[1]
, otherwise with the byte[]
at f[0]
.
What I do at the moment is that for the return value I simply take the steps shown above. but since this is "hard-coded" I have a bad feeling with f[help[5]].jcint
and would like to know a smoother way.