Guest User

Untitled

a guest
Mar 29th, 2014
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. // Process message into chunks
  2. function chunkMessage( str )
  3. {
  4. nblk = ((str.length + 8) >> 6) + 1;
  5. blks = new Array(nblk * 16);
  6.  
  7. for(i = 0; i < nblk * 16; i++)
  8. {
  9. blks[i] = 0;
  10. }
  11. for(i = 0; i < str.length; i++)
  12. {
  13. blks[i >> 2] |= str.charCodeAt(i) << ((i % 4) * 8);
  14. }
  15.  
  16. blks[i >> 2] |= 0x80 << ((i % 4) * 8);
  17. blks[nblk * 16 - 2] = str.length * 8;
  18.  
  19. return blks;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment