Skip to main content
. 2023 Jul 31;25(8):1147. doi: 10.3390/e25081147
Algorithm 1 Hash value stacking algorithm
  • Input: 

    The plaintext image P and its SHA-256 hash value V(0) of length 32 bytes, and the key streams Q(1) and Q(2).

  •   1:

    Set both v(s) and v(x) to 0;

  •   2:

    for  i=1 to 32 do

  •   3:

       v(s)=(v(s)+V(0)(i))mod256;

  •   4:

       v(x)=v(x)V(0)(i);

  •   5:

    end for

  •   6:

    Set U(x)=transpose(Q(1))×Q(2);

  •   7:

    Set U(s)=v(s)×U(x);

  •   8:

    U(x)=v(x)×U(x);

  •   9:

    Set C(1)=(P+U(s)+U(x))mod256

  • Output: 

    The intermediate ciphertext image C(1).