Documentation ¶
Index ¶
- Constants
- Variables
- func BytesHash(bs []byte, algo crypto.Hash) string
- func BytesSha1(bs []byte) string
- func FileHash(path string, algo crypto.Hash) (string, error)
- func FileSha1(path string) (string, error)
- func Hash(reader io.Reader, algo crypto.Hash) (string, error)
- func OtherPlatformHash(reader io.Reader, algo crypto.Hash) (string, error)
- func OtherPlatformSha1(reader io.Reader) (string, error)
- func StringHash(str string, algo crypto.Hash) string
- func StringSha1(str string) string
- type SuperHash
Constants ¶
View Source
const ( Sha1 = "SHA1" AdditionalSha1 = "ADDITIONAL_SHA1" )
Variables ¶
Functions ¶
func OtherPlatformHash ¶
OtherPlatformHash calculates the hash of the provided io.Reader contents, after replacing the line endings to the other platform type. if the line endings are CRLF, they will be switched to LF if the line endings are LF, they will be switched to CRLF
func StringSha1 ¶
Types ¶
type SuperHash ¶
type SuperHash struct { // FullHash contains a hash of the whole file FullHash string // MosSigBitsHash contains a hash of the first bits of the file. Amount of bits determined by bucket size. MostSigBitsHash string // LeastSigBitsHash contains a hash of the last bits of the file. Amount of bits determined by bucket size. LeastSigBitsHash string // contains filtered or unexported fields }
SuperHash contains various hashes of a source file. All hashes are performed after stripping away all whitespace from the file
func CalculateSuperHash ¶
CalculateSuperHash calculates the super hash of the provided reader, with the provided hash algorithm
func CalculateSuperSha1 ¶
func CalculateSuperSha1(rs io.ReadSeeker) (*SuperHash, error)
Click to show internal directories.
Click to hide internal directories.