You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The RC4 cipher generates a constant byte as key stream after a while (~160 characters). The reason is that i and j are initialized to 0 every time arcfour_generate_stream() is called, but they should be part of the global state initialized to 0 only once.
Pseudocode of RC4 PRG algorithm:
i := 0
j := 0
while GeneratingOutput:
i := (i + 1) mod 256
j := (j + S[i]) mod 256
swap values of S[i] and S[j]
K := S[(S[i] + S[j]) mod 256]
output K
endwhile
The RC4 cipher generates a constant byte as key stream after a while (~160 characters). The reason is that
i
andj
are initialized to 0 every timearcfour_generate_stream()
is called, but they should be part of the global state initialized to 0 only once.Pseudocode of RC4 PRG algorithm:
The implementation in this repo:
The text was updated successfully, but these errors were encountered: