File: sha256.go

package info (click to toggle)
golang-github-ffuf-pencode 0.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 224 kB
  • sloc: makefile: 2; sh: 1
file content (20 lines) | stat: -rw-r--r-- 334 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
package pencode

import (
	"crypto/sha256"
	"fmt"
)

type SHA256Hasher struct{}

func (m SHA256Hasher) Encode(input []byte) ([]byte, error) {
	return []byte(fmt.Sprintf("%x", sha256.Sum256(input))), nil
}

func (m SHA256Hasher) HelpText() string {
	return "SHA256 checksum"
}

func (m SHA256Hasher) Type() string {
	return "hashes"
}