Skip to main content
. 2021 Dec 8;23(12):1650. doi: 10.3390/e23121650
Algorithm 4 Pseudo random key generation from Random key.
  • Require: 

    Random key (128 bits)

  • Ensure: 

    Pseudo Random key ((P×Q)/2 )

  • 1:
    Initial conditions a0, b0, S1 and S2 are generated as follows:
    a0=K=120Randomkey(K)2K
    b0=(K=2150Randomkey(K)2K52)mod1
    S1=(K=18Randomkey(K)×2K+K=2576Randomkey(K)2K24+b0)mod10+10
    S2=(K=121128Randomkey(129K)×2K+K=77128Randomkey(K)2K76×S1)mod10+10
    a0=(a0+S2)mod1
  • 2:
    The initial values a0,S1andb0,S2 are used for the logistic and sine map, respectively. The maps are iterated P×Q times, whereby the random sequences are stored as matrices LF and SF of size P×Q as
    LF=mod((power(S1,2)×a0×(1S1a0)+S1a0),1)
    SF=mod((S2sin(180S2b0)+S2b0,1)
  • 3:
    Based on these intermediary matrices, a final Pseudo random key PRKey is then calculated as
    PRkey=k=1Pl=1Q(((LF(k,l)+SF(k,l)))mod10)
    where LF(k, l) and SF(k, l) are the elements of the LF and SF matrices, respectively, while k and l denote the row and column of LF. The resulting matrix PRkey is Pseudo random key in the range of [1,(P×Q)2], where P×Q is the size of the watermark image.