mirror of
https://github.com/imgproxy/imgproxy.git
synced 2024-11-29 08:22:11 +02:00
21 lines
386 B
Go
21 lines
386 B
Go
package main
|
|
|
|
import (
|
|
"crypto/sha1"
|
|
"encoding/binary"
|
|
"fmt"
|
|
)
|
|
|
|
var notModifiedErr = newError(304, "Not modified", "Not modified")
|
|
|
|
func calcETag(b []byte, po *processingOptions) string {
|
|
footprint := sha1.Sum(b)
|
|
|
|
hash := sha1.New()
|
|
hash.Write(footprint[:])
|
|
binary.Write(hash, binary.LittleEndian, *po)
|
|
hash.Write(conf.ETagSignature)
|
|
|
|
return fmt.Sprintf("%x", hash.Sum(nil))
|
|
}
|