Restructured the code for consistency and cleaned up some if else chains.
Removed the str2rstr_utf8() function since it's faster and more simple to use unescape(encodeURI()) before passing data into the algorithms, it also fixes a bug with encoding large 4-byte length characters.
Removed the need for a safe_add function since it isn't needed with a few well-placed |0's.
Removed the chrsz variable and use immediate*8 since history has locked passwords into being generated from 8-bit strings anyway.
Inlined the R, Ch and Maj functions in sha256.js since they are simple enough.