Hacker News new | ask | show | jobs
by inersha 2224 days ago
If you add the third optional argument of "enter" when running the sha256.rb script you can use your keyboard to step through. I haven't set this up for the individual animations though.

ruby sha256.rb sizzzzlerz enter

I didn't do anything special for the terminal animation. I just work out the current state of the hash function at each step, clear the terminal, and print the entire state back to the screen. I know it looks like I'm directly manipulating each individual bit in your terminal, but really I'm just redrawing your screen.

I'd like to do something more practical in future, but for this I just did what I needed to do to get an animation working. Still, every bit you are seeing is correct.

1 comments

Thanks! I detected a few flashes in some lines that weren't active but I didn't believe you could clear and reprint the entire screen that fast. Very cool!