Discover Packages
github.com/danmestas/libfossil
internal
hash
package
Version:
v0.6.3
Opens a new window with list of versions in this module.
Published: May 13, 2026
License: MIT
Opens a new window with license information.
Imports: 3
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
Documentation
Documentation
¶
ContentHash hashes content using the algorithm implied by referenceHash length.
64-char reference = SHA3-256, otherwise SHA1. referenceHash must not be empty.
package main
import (
"fmt"
"github.com/danmestas/libfossil/internal/hash"
)
func main() {
uuid := hash.SHA1([]byte("hello"))
fmt.Println(uuid)
fmt.Println(hash.IsValidHash(uuid))
}
Output:
aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d
true
package main
import (
"fmt"
"github.com/danmestas/libfossil/internal/hash"
)
func main() {
uuid := hash.SHA3([]byte("hello"))
fmt.Println(len(uuid)) // 64 hex chars = SHA3-256
fmt.Println(hash.IsValidHash(uuid))
}
Output:
64
true
Source Files
¶
Click to show internal directories.
Click to hide internal directories.