aboutsummaryrefslogtreecommitdiffstats
path: root/util.go
blob: fc06673d2c9e7ce5f31189dd0667b145af75c3e0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package main

import (
  "strconv"
  "crypto/sha256"
  "encoding/hex"
)

func Uitoa(i uint32) string {
  return strconv.FormatUint(uint64(i), 10)
}

func Sha256Hex(data []byte) string {
  hash := sha256.Sum256(data)

  return hex.EncodeToString(hash[:])
}

func Sha256Bin(data []byte) []byte {
  hash := sha256.Sum256(data)

  return hash[:]
}