I believe that I came across one of them by Paul Johnston at http://pajhome.org.uk/crypt/md5/contrib/sha1_stream.js . It is listed at http://pajhome.org.uk/crypt/md5/scripts.html . I did not test it myself, but I used its version without streaming, which he modified for it.
UPDATE: Here is a sample code (I tested it against a separate SHA1, which, as you know, was correct). Make sure you include the original sha1.js file (found at http://pajhome.org.uk/crypt/md5/sha1.js ) before the streaming sha1_stream.js.
<script src="sha1.js" type="text/javascript" charset="utf-8"></script> <script src="sha1_stream.js" type="text/javascript" charset="utf-8"></script> <script type="text/javascript" charset="utf-8"> var input = ''; var blocksize = 512; var h = naked_sha1_head(); for (var i = 0; i < input.length; i += blocksize) { var len = Math.min(blocksize, input.length - i); var block = input.substr(i, len); naked_sha1(str2binb(block), len*chrsz, h); } var result = binb2hex(naked_sha1_tail(h)); </script>
sunetos
source share