Tag Security

How to hash and compare passwords in Go
0 min read

The best to hash passwords in Go is using golang.org/x/crypto/bcrypt:

func HashPassword(password string) (string, error) {
    bytes, err := bcrypt.GenerateFromPassword([]byte(password), bcrypt.DefaultCost)
    return string(bytes), err
}
  
func CheckPasswordHash(password, hash string) bool {
    err := bcrypt.CompareHashAndPassword([]byte(hash), []byte(password))
    return err == nil
}

You should use the default bcrypt.DefaultCost just in case that the current value will become not sufficient and the default cost will increase.

I talk to spammers. Here is what I found
4 min read

From time to time, I receive an email from a scammer that says he has X million dollars/euro for me. At the very beginning, I removed those emails but at some point, I decided to answer them. Here’s what I found. Every scammer starts very typically. There’s a very reach person who’s dying or very sick. They found my email on the Internet and learned that I’ll be the person who will spend the money wisely.