Abstractly speaking, a hash function and a symmetric cipher are "the same thing". But, concretely, there is a symmetry between Stream cipher: map a fixed-length random input to a variable-length random output Hash function: map a variable-length random input to a fixed-length random output
Basic "while" loop in Elixir
Given this Python code: def f(k): n = 2 << k q = 2 i = 1 while q != n: i *= q q <<= 1 return i The Elixir translation is roughly the following: def f(k) do n = 2 <<< k # Remember to add "use Bitwise" at the top of the module q = 2 i = 1 # (Storing the output into a tuple …