cityuni-webserver/pageHandler/utils/buffered-writer.go
Captain ALM 11deb796e8
All checks were successful
continuous-integration/drone Build is passing
Begin adding page handling system, add utils for the pageHandler system.
2022-07-14 23:25:43 +01:00

24 lines
406 B
Go

package utils
import (
"crypto"
"encoding/hex"
)
type BufferedWriter struct {
Data []byte
}
func (c *BufferedWriter) Write(p []byte) (n int, err error) {
c.Data = append(c.Data, p...)
return len(p), nil
}
func (c *BufferedWriter) GetHashString() string {
theHash := crypto.SHA1.New()
_, _ = theHash.Write(c.Data)
theSum := theHash.Sum(nil)
theHash.Reset()
return hex.EncodeToString(theSum)
}