Skip to content
This repository was archived by the owner on May 19, 2025. It is now read-only.
junekimdevPublic archive

About

Hash algorithms in Golang

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hash

Hash algorithms in Golang

PkgGoDev Go Report Card GitHub tag (latest by date) GitHub


Getting Started

Installing

go get it (pun intended 😸)

go get github.com/junekimdev/hash

Usage

package main

import (
  "log"

  "github.com/junekimdev/hash"
)


func main() {
  // Got password over https
  // Hash it to store
  hashedPassword, err := Run(password)
  if err != nil {
    log.Println(err)
  }

  // Got password over https &
  // Got store password from DB
  // Verify it
  match, err := Verify(password, hashedPassword)
  if err != nil {
    log.Println(err)
  }

  // Hashing a file with sha1 algorithm
  filename := "HASH_ME.txt"
  if hashedFile, err := RunFile(filename); err != nil {
    log.Println(err)
  }
  // Use hashedFile to evaluate equality of two files
  // like what GIT does...

  // Lightweight but risky hashing
  // SHA1 algorithm is not considered as a secure algorithm at this moment of time
  // But there are many use cases SHA1 algorithm can be useful

  // RunSha1 can take more than one string; order matters
  hash1 := RunSha1(input1, input2)
  hash2 := RunSha1(input3, input4)
  if hash1 == hash2 {
    log.Println("Same inputs")
  }
}

About

Hash algorithms in Golang

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages