title: How would I go about reading bittorrent pieces?
body: <p>I'm currently developing a torrent metainfo management library for Ruby.</p>
  
  <p>I'm having trouble reading the pieces from the files. I just don't understand how I'm supposed to go about it. I know I'm supposed to SHA1 digest <strong>piece length</strong> bytes of a file once (or read <strong>piece length</strong> bytes multiple times, or what?)</p>
  
  <p>I'm counting on your help.
  Pseudo / Python / Ruby / PHP code preferred.</p>
  
  <p>Thanks in advance.</p>