--- title: Stream Ciphers tags: crypto lang: zh_tw --- * [筆記總覽](https://hackmd.io/@LJP/rkerFdnqS) [TOC] # Stream Ciphers  圖中的 `Pseudorandom byte generator` 即可用 [PRNGs](#Pseudorandom-Number-Generators-PRNGs) 來做 是以 bit 為單位用 xor 做加密(圖中的 byte 應該是錯誤的,應改成 bit) ## Pseudorandom Number Generators (PRNGs) > use deterministic algorithmic techniques to create random numbers >  還是要給 seed 才會產生偽隨機數,若給的 seed 一樣,則產生的數字也會一樣 ### Linear Congruential Generator $X_{n+1}=(aX_n+c)mod\ m$ 若 $m$ 為 prime 且 $c$ 為 0,則此亂數表的週期是 $m-1$,並且不存在 0 ### Blum Blum Shub Generator 1. 挑兩個大質數符合 - $p\equiv q\equiv 3\ (mod\ 4)$ 2. 挑一個數 $s$ 跟 $n=p\times q$ 互質 3. 將 $s$ 作為 $x_{-1}$,做 $x_i = x_{i-1}^2\ mod\ n$,並且只使用 LSB 可以參考 [wiki 上的 example](https://en.wikipedia.org/wiki/Blum_Blum_Shub#Example) ### Using Block Ciphers as PRNGs 也可以用 Block Cipher Algorithm e.g. DES 來當 PRNGs ## RC4 [影片解釋的很清楚](https://www.youtube.com/watch?time_continue=271&v=kfdvlaOD1ig)
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up