Add Hash generator

This commit is contained in:
Dan Jones 2025-03-14 14:45:55 -05:00
commit 8888ee3855
5 changed files with 124 additions and 1 deletions

View file

@ -161,3 +161,33 @@ func ExampleSlugWithLang() {
// Output: diese-und-dass.txt
}
func ExampleHash_mD5() {
conf := NewConfig(
WithOriginal("foobar"),
WithGenerator(Hash(MD5)),
)
str, _ := Make(conf)
fmt.Println(str)
// Output: 3858f62230ac3c915f300c664312c63f.txt
}
func ExampleHash_sHA1() {
conf := NewConfig(
WithOriginal("foobar"),
WithGenerator(Hash(SHA1)),
)
str, _ := Make(conf)
fmt.Println(str)
// Output: 8843d7f92416211de9ebb963ff4ce28125932878.txt
}
func ExampleHash_sHA256() {
conf := NewConfig(
WithOriginal("foobar"),
WithGenerator(Hash(SHA256)),
)
str, _ := Make(conf)
fmt.Println(str)
// Output: c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2.txt
}