...

Source file src/github.com/go-task/slim-sprig/v3/crypto.go

Documentation: github.com/go-task/slim-sprig/v3

     1  package sprig
     2  
     3  import (
     4  	"crypto/sha1"
     5  	"crypto/sha256"
     6  	"encoding/hex"
     7  	"fmt"
     8  	"hash/adler32"
     9  )
    10  
    11  func sha256sum(input string) string {
    12  	hash := sha256.Sum256([]byte(input))
    13  	return hex.EncodeToString(hash[:])
    14  }
    15  
    16  func sha1sum(input string) string {
    17  	hash := sha1.Sum([]byte(input))
    18  	return hex.EncodeToString(hash[:])
    19  }
    20  
    21  func adler32sum(input string) string {
    22  	hash := adler32.Checksum([]byte(input))
    23  	return fmt.Sprintf("%d", hash)
    24  }
    25  

View as plain text