Is cryptography in Go hard?
reddit.com·9h·
Discuss: r/golang
Flag this post

I been having a slower time learning cryptography in Go compared to other languages due to all of the juggling to simply encrypt a string or the limitations of 72 characters to generate a secure hash with a salt.

Is there some sort of 3rd party library that is popular, maintained and trusted that I do not know of that makes crypto in go much easier.

For example, this is how I generate a hash with as salt with timing attack security but I am stuck with using bcrypt which is limited to 72 characters.

package main

import (
"encoding/hex"
"fmt"

"golang.org/x/crypto/bcrypt"
)

const Password = "mypassword"

func main() {
//Generate hash with salt
hashWithSaltBytes, err := bcrypt.GenerateFromPassword([]byte(Password), bcrypt.MinCost)
if err != nil {
//,,,
}

//Convert bytes into hex...

Similar Posts

Loading similar posts...