Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import (
- "crypto/sha256"
- "fmt"
- "io/ioutil"
- "os"
- "strconv"
- )
- func main() {
- iterations, err := strconv.Atoi(os.Args[1])
- if err != nil {
- iterations = 1
- }
- data, _ := ioutil.ReadFile("rand.txt")
- hash := getHash(data, iterations)
- fmt.Printf("%x\n", hash)
- }
- func getHash(data []byte, iterations int) []byte {
- for i := 0; i < iterations; i++ {
- hash := sha256.New()
- hash.Write(data)
- data = hash.Sum(nil)
- }
- return data
- }
Add Comment
Please, Sign In to add comment