Message digest from file

Anyone could tell me how to tweak these codes so that it could digest the text from file instead of assign letter "M".I had tried so many example of read from file algorithm to implement on it ,but failed.It keeps return the error of incompatibility object type ,since the text to be digest is byte form instead of String