public Map < ChecksumType , String > calculateJavaScriptHashes ( File file ) throws WssHashException { Map < ChecksumType , String > checksums = new EnumMap <> ( ChecksumType . class ) ; try { long fileLength = file . length ( ) ; if ( fileLength >= FILE_MAX_SIZE_THRESHOLD ) { logger . debug ( "Ignore file {}, ({}): maximum file size is 2GB" , file . getName ( ) , FileUtils . byteCountToDisplaySize ( fileLength ) ) ; return checksums ; } checksums = calculateJavaScriptHashes ( FileUtils . readFileToByteArray ( file ) ) ; } catch ( Exception e ) { throw new WssHashException ( "Error calculating JavaScript hash: " + e . getMessage ( ) ) ; } return checksums ; }
Removes all JavaScript comments from the file and calculates SHA - 1 checksum .