func FromReader(src io.ReadSeeker, fileSize int64) (string, error) {
	if fileSize == 0 {
		return "", nil
	}

	fileChunkSize := chunkSize
	if fileSize < fileChunkSize {
		fileChunkSize = fileSize
	}

	head := make([]byte, fileChunkSize)
	tail := make([]byte, fileChunkSize)

	// read the head of the file into the start of the buffer
	_, err := src.Read(head)
	if err != nil {
		return "", err
	}

	// seek to the end of the file - the chunk size
	_, err = src.Seek(-fileChunkSize, 2)
	if err != nil {
		return "", err
	}

	// read the tail of the file
	_, err = src.Read(tail)
	if err != nil {
		return "", err
	}

	return oshash(fileSize, head, tail)
}
// FromFilePath calculates the hash reading from src.
FromFilePath calculates the hash reading from src.
// FromFilePath calculates the hash reading from src .
func FromReader(src io.ReadSeeker, fileSize int64) (string, error) {
	if fileSize == 0 {
		return "", nil
	}
	fileChunkSize := chunkSize
	if fileSize < fileChunkSize {
		fileChunkSize = fileSize
	}
	head := make([]byte, fileChunkSize)
	tail := make([]byte, fileChunkSize)
	_, err := src.Read(head)
	if err != nil {
		return "", err
	}
	_, err = src.Seek(-fileChunkSize, 2)
	if err != nil {
		return "", err
	}
	_, err = src.Read(tail)
	if err != nil {
		return "", err
	}
	return oshash(fileSize, head, tail)
}
func FromReader ( src io . ReadSeeker , fileSize int64 ) ( string , error ) { if fileSize == 0 { return " " , nil } fileChunkSize := chunkSize if fileSize < fileChunkSize { fileChunkSize = fileSize } head := make ( [ ] byte , fileChunkSize ) tail := make ( [ ] byte , fileChunkSize ) _ , err := src . Read ( head ) if err != nil { return " " , err } _ , err = src . Seek ( - fileChunkSize , 2 ) if err != nil { return " " , err } _ , err = src . Read ( tail ) if err != nil { return " " , err } return oshash ( fileSize , head , tail ) }
FromFilePath calculates the hash reading from src.
FromFilePath calculates the hash reading from src .
// read the head of the file into the start of the buffer // seek to the end of the file - the chunk size // read the tail of the file