0

i want to encrypt pixel value using henon equation :

Xi+2 = 1 - a*(Xi+1)*(Xi+1) + bXi (sorry i can't post image)

where a=1.4, b=0.3, x0=0.01, x1=0.02,

with this code :

k[i+2] =1-a*(Math.pow(k[i+1], 2))+b*k[i]

i can get random value from henon equation

1.00244, -0.40084033504000005, 1.0757898361270288, -0.7405053806319072, 0.5550494445953806, 0.3465365454865311, 0.99839222507778, -0.2915408854881054, 1.1805231444476698, -1.038551118053691, -0.15586685140049938, 0.6544223990721852,

. after that i rounded the random value

with this code :

inter[i]= (int) Math.round((k[i]*65536)%256)

i can encrypt the pixel value by XOR with random value (henon).

my question :

there are some negative random value from henon, as we know that there aren't negative pixel value.

so may i skip the negative random value (only save positive random value) to encrypt original pixel value ?

Thanks

user1552917
  • 101
  • 4

1 Answers1

0

You are using the Hénon sequence as a source for pseudo-random numbers, right?

Then you can of course chose to discard negative numbers (or take the absolute value, or do some other fancy thing) - as long as you do the same in encryption and decryption. If there is a specification, it should better be explicit about this.

Maybe you are using Javascript or some other language where % is not modulus, but remainder. If so, see this answer


Three other things to note:

  • Double-check that you are claculating the right thing. It seems to me that your calculation should read k[i+1] =1-a*(Math.pow(k[i], 2))+b*k[i], since the Hénon sequence only uses the last value. `
  • Do you really need to store past values of k? If not, then just use

    k =1-a*(Math.pow(k, 2))+b*k

or even better

k = 1 + k * (b - a *k)
  • (Spoiler warning: This may be the didactical point of an exercise.) The Hénon sequence is chaotic, and floating point errors will sooner or later influence the random numbers. So your random number generator maybe isn't as deterministic as you think.
Community
  • 1
  • 1
tiwo
  • 3,238
  • 1
  • 20
  • 33
  • *yes sir i'm using henon sequences for generating pseudo random. thanks for the answer sir so i can take only absolute number *i think the modulus bug in java only in negative value right ? *following my [conference][1] [1]: http://ieeexplore.ieee.org/xpl/login.jsp?tp=&arnumber=5054653&url=http://ieeexplore.ieee.org/iel5/4976857/5054562/05054653.pdf?arnumber=5054653 i think i need to store k, because each random will be xor with pixel value one by one, or i make mistake sir ? – user1552917 Jul 26 '12 at 01:58
  • sir i think i forget something (mistake), when i generating pseudo number with k[i+2] =1-a*(Math.pow(k[i+1], 2))+b*k[i]. off course i get negative number. But, following this inter[i]= (int) Math.round((k[i]*65536)%256), the negative value can be absolute, is that right sir ? :D – user1552917 Jul 26 '12 at 02:45
  • I'm not sure what the "modulus bug" is or what you expect the code to do. I think that Java is infected with the widespread negative-modulus-disease: `-1 % 10 == -1`, where it better should equal 9. To always get positive numbers either ensure that `k[i]` is >= 0, or do (k[i]*65536 + 256) % 256. – tiwo Jul 26 '12 at 12:41
  • @tiwo that modulus disease is called "remainder" but I agree that it is a PITA. – Maarten Bodewes Jul 31 '12 at 19:26