Rolling Checksum

Someone ever build a Rolling Checksum with Ruby?

Im curious how Rsync works want to build a small rsync in ruby just to
study, the part i cant get over is the rolling checksum…

I dont mind how to do this.