Update base64_encode length parameter to more sane type references #358

Also adds documentation and cleans up formatting
Update sha1::calc length parameter to more sane type references #358

also cleans up formatting and code style and adds documentation