Hashing

Overview

This page contains recommendations for choosing a hashing algorithm.

General

Vulnerable hash algorithms
  • MD4

  • MD5

  • SHA-0

  • SHA-1

  • HAVAL-128

  • PANAMA

  • RIPEMD

Hashing implementation

Use the implementation of hash algorithms from the crypto package, such as crypto/sha256 or crypto/sha512. You can find the whole list at https://pkg.go.dev/crypto#Hash

package main

import (
    "crypto/sha256"
    "fmt"
)

func main() {
    p := []byte("random string for hashing")
    hash := sha256.New()
    fmt.Printf("%x\n", hash.Sum(p))
}

Last updated