package main import ( "fmt" "github.com/coreos/rkt/godeps/_workspace/src/github.com/appc/spec/schema/types" ) func main() { // Create a new hash from a string h, err := types.NewHash("sha512:abc123") if err != nil { panic(err) } fmt.Println(h.String()) // sha512:abc123 // Generate a random SHA256 hash h = types.GenerateRandomHash("sha256") fmt.Println(h.String()) // sha256:5b5d60d9dab4e3f52336f9d9d2d613c53288ebc7c23b67e39aa7f1ac3e4c90f7 }In the first example, we create a new Hash object from a string with the format "algorithm:hex". The NewHash function returns an error if the provided string does not match this format. The hash's String method returns the original string. In the second example, we use the GenerateRandomHash function to create a new Hash with a random value. This function takes an algorithm string ("md5", "sha256", etc.) and returns a new Hash object with a random value for that algorithm. Overall, the Hash type provides a convenient way to work with cryptographic hashes in Go, and it is a useful part of the appc/spec/schema/types package.