Created
December 9, 2010 22:46
-
-
Save flazz/735456 to your computer and use it in GitHub Desktop.
fixes sha1#update bug on OSX
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'digest/sha1' | |
| # this patch fixes SHA1#update on OSX | |
| class Digest::SHA1 | |
| def update s | |
| buf_size = 1024 ** 2 | |
| if s.size > buf_size | |
| io = StringIO.new s | |
| buf = String.new | |
| super buf while io.read(buf_size, buf) | |
| else | |
| super s | |
| end | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment