Skip to content

Commit

Permalink
blog: Fix typo
Browse files Browse the repository at this point in the history
  • Loading branch information
purplesyringa committed Apr 23, 2024
1 parent ccc8626 commit 1ab41bd
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion blog/recovering-garbled-bitcoin-addresses/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -989,7 +989,7 @@
<span class=hljs-keyword>let</span> <span class=hljs-variable>s1</span> = <span class="hljs-title function_ invoke__">rotate_right</span>(w[i - <span class=hljs-number>2</span>], <span class=hljs-number>17</span>) ^ <span class="hljs-title function_ invoke__">rotate_right</span>(w[i - <span class=hljs-number>2</span>], <span class=hljs-number>19</span>) ^ (w[i - <span class=hljs-number>2</span>] >> <span class=hljs-number>10</span>);
w[i] = w[i - <span class=hljs-number>16</span>] + s0 + w[i - <span class=hljs-number>7</span>] + s1;
}
</code></pre><p><code>sha256msg1</code> computes <code>w[i - 16] + s0</code> for for consecutive <code>i</code>s. <code>sha256msg2</code> <em>would</em> compute <code>w[i - 7] + s1</code> for four consecutive <code>i</code>s, if only <code>w[i]</code> didn’t depend on <code>w[i - 2]</code>, so instead of computes <code>w[i]</code> given the result of <code>sha256msg1</code> and the previous values of <code>w</code>. Here is how they are meant to be used, roughly speaking:<pre><code class=language-rust><span class=hljs-keyword>for</span> <span class=hljs-variable>i</span> <span class=hljs-keyword>in</span> (<span class=hljs-number>16</span>..<span class=hljs-number>64</span>).<span class="hljs-title function_ invoke__">step_by</span>(<span class=hljs-number>4</span>) {
</code></pre><p><code>sha256msg1</code> computes <code>w[i - 16] + s0</code> for four consecutive <code>i</code>s. <code>sha256msg2</code> <em>would</em> compute <code>w[i - 7] + s1</code> for four consecutive <code>i</code>s, if only <code>w[i]</code> didn’t depend on <code>w[i - 2]</code>, so instead of computes <code>w[i]</code> given the result of <code>sha256msg1</code> and the previous values of <code>w</code>. Here is how they are meant to be used, roughly speaking:<pre><code class=language-rust><span class=hljs-keyword>for</span> <span class=hljs-variable>i</span> <span class=hljs-keyword>in</span> (<span class=hljs-number>16</span>..<span class=hljs-number>64</span>).<span class="hljs-title function_ invoke__">step_by</span>(<span class=hljs-number>4</span>) {
w[i..i + <span class=hljs-number>4</span>] = <span class="hljs-title function_ invoke__">sha256msg2</span>(<span class="hljs-title function_ invoke__">sha256msg1</span>(w[i - <span class=hljs-number>16</span>..i - <span class=hljs-number>12</span>], w[i - <span class=hljs-number>12</span>..i - <span class=hljs-number>8</span>]) + w[i - <span class=hljs-number>7</span>..i - <span class=hljs-number>3</span>], w[i - <span class=hljs-number>4</span>..i]);
}
</code></pre><p><code>sha256rnds2</code> performs two rounds of the main loop of SHA-256, meaning that this:<pre><code class=language-rust><span class=hljs-keyword>for</span> <span class=hljs-variable>i</span> <span class=hljs-keyword>in</span> (<span class=hljs-number>0</span>..<span class=hljs-number>64</span>).<span class="hljs-title function_ invoke__">step_by</span>(<span class=hljs-number>8</span>) {
Expand Down
2 changes: 1 addition & 1 deletion blog/recovering-garbled-bitcoin-addresses/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -1589,7 +1589,7 @@ for i in 16..64 {
}
```

`sha256msg1` computes `w[i - 16] + s0` for for consecutive `i`s. `sha256msg2` *would* compute `w[i - 7] + s1` for four consecutive `i`s, if only `w[i]` didn't depend on `w[i - 2]`, so instead of computes `w[i]` given the result of `sha256msg1` and the previous values of `w`. Here is how they are meant to be used, roughly speaking:
`sha256msg1` computes `w[i - 16] + s0` for four consecutive `i`s. `sha256msg2` *would* compute `w[i - 7] + s1` for four consecutive `i`s, if only `w[i]` didn't depend on `w[i - 2]`, so instead of computes `w[i]` given the result of `sha256msg1` and the previous values of `w`. Here is how they are meant to be used, roughly speaking:

```rust
for i in (16..64).step_by(4) {
Expand Down

0 comments on commit 1ab41bd

Please sign in to comment.