ROT encryption with hash functions I am not trying to create my own encryption (I am just interested in the math and possibility of this form of "encryption"). I apoligize if this post does not fit in, it is my first time posting.

A Caesar cipher is probably the most basic form of encryption, but what if we were to step it up?


We take a password key
We hash it through a SHA256 algorithm and save the result
We hash the result multiple times saving the result each time
We take all of the results and stack them (using simple numbers for example)

123 &lt; Hash
 321 &lt; Hash 2
 221 &lt; Hash 3
We add up the values of each column

1  2  3 &lt; Hash 1
  3  2  1 &lt; Hash 2
  2  2  1 &lt; Hash 3
 (6)(6)(5) &lt; Final result
We apply the resulting numbers to our text to be encrypted through a Caesar cipher
When we get to the last digit in the ROT, we continue steps 3-6 untill complete


Decryption would be as simple as entering a password to hash over and over and undo the Caesar cipher

What is the practicality of this; does it exist/what would be potential flaws?

Here is an example of this encryption in python. Run the program and you will see what I am trying to explain.
What you are describing is a strange version of OFB mode, using a hash function instead of a block cipher and modular addition instead of XOR to combine the data with the keystream. The algorithm you describe appears vulnerable to known plaintext attacks. A simple tweak to make it more similar to true OFB mode would improve security. OFB mode is a stream cipher mode:

\begin{align*}
O_i = E_K(O_{i-1}) \quad\text{where}\quad O_0 = IV
\end{align*}

The keystream is $O$, so encryption and decryption is implemented as in any stream cipher:

\begin{align*}
C_i &amp;= P_i \oplus O_i\\
P_i &amp;= C_i \oplus O_i
\end{align*}

This technique can be visualized:



The block cipher, $E$, can be replaced with any keyed hash function. The hash function must be keyed and the initial input must be an IV, not a key, otherwise it is vulnerable to a known plaintext attack where an attacker who can derive one of the outputs can use it to calculate the rest of the keystream. Your current construction is $O_i = H(O_{i-1})$ where $O_0 = H(K)$, with multiple blocks of keystream $O$ being used to encrypt a single block of plaintext. If I understand this correctly, this does not resist known plaintext attacks. Instead, you need to use a keyed hash and the first input should be an IV. One of the most common keyed hash constructions is an HMAC:

\begin{align*}
\operatorname{HMAC}_K(m) = H((K \oplus \mathrm{opad}) \mathbin\| H((K \oplus \mathrm{ipad}) \mathbin\| m))
\end{align*}

The $\oplus$ represents the XOR operation. Any operation that can be reversed with the same input can be used for this purpose, not just XOR. In your scenario, a Caesar cipher functions as modular addition, so if I understand what you are describing correctly, it should have similar security to OFB mode, including its pitfalls (short permutation cycles, for example), as long as you replace your hash function with a proper keyed hash like an HMAC.