Last active
March 28, 2020 10:34
-
-
Save froyobin/8cbcb44bbee29f541d10aa61146b0f6d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"bytes" | |
"crypto/sha256" | |
"fmt" | |
"math" | |
"time" | |
) | |
func main() { | |
//time differnece | |
timeNow := time.Now() | |
timeLater := timeNow.Add(time.Second * 16 * 60) | |
delta := math.Ceil(timeLater.Sub(time.Now()).Minutes() / 5) | |
fmt.Printf("------->%v\n", delta) | |
// hash | |
str := timeNow.String() | |
fmt.Printf("----->%v\n", timeNow.UTC()) | |
sum := sha256.Sum256([]byte(str)) | |
fmt.Printf("%x", sum) | |
// combine keys | |
var keyBuffer bytes.Buffer | |
key1 := []byte("hello") | |
key2 := []byte("+word") | |
key3 := []byte("+word1") | |
key4 := []byte("+word2") | |
keyBuffer.Write(key1) | |
keyBuffer.Write(key2) | |
keyBuffer.Write(key3) | |
keyBuffer.Write(key4) | |
combinedKey := keyBuffer.Bytes() | |
fmt.Printf("------>%v\n", string(combinedKey)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment