@@ -34,13 +34,13 @@ func GetBlockInfo(fileSize int64) (blockSize int, length int) {
3434 return
3535}
3636
37- //get the hash of the data
37+ // Get the hash of the data.
3838func GetHashByContent (data []byte ) string {
3939 sum := md5 .Sum (data )
4040 return hex .EncodeToString (sum [:])
4141}
4242
43- //get the hash of the data
43+ // Get the hash of the data.
4444func GetHashByPath (path string ) string {
4545 pFile , err := os .Open (path )
4646 if err != nil {
@@ -52,13 +52,13 @@ func GetHashByPath(path string) string {
5252 return hex .EncodeToString (md5h .Sum (nil ))
5353}
5454
55- //Comparison data hash
55+ // Compare data hash.
5656func ComparisonHash (data []byte , hash string ) bool {
5757 sum := md5 .Sum (data )
5858 return hex .EncodeToString (sum [:]) == hash
5959}
6060
61- //get prefix byte length
61+ // Get prefix byte length.
6262func PrefixLength (byteLength int ) []byte {
6363 lengthByte := []byte {'0' , '0' , '0' , '0' , '0' , '0' }
6464 bSize := strconv .Itoa (byteLength )
@@ -69,7 +69,7 @@ func PrefixLength(byteLength int) []byte {
6969 return lengthByte
7070}
7171
72- //get data byte length
72+ // Get data byte length.
7373func DataLength (length int ) []byte {
7474 lengthByte := []byte {'0' , '0' , '0' , '0' , '0' , '0' , '0' , '0' }
7575 bSize := strconv .Itoa (length )
0 commit comments