Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I understand that your comment is about this book, but I'll go ahead and answer your questions with links to packages (plus I get a chance to plug a few of my own creation :). If you want to learn how they work, reading docs and code is the best exercise. It's not a substitute for the proper book, though, but may turn out to be useful.

How password should be encrypted?

Choose your package:

    go get github.com/dchest/scrypt
    go get code.google.com/p/go.crypto/bcrypt
    go get code.google.com/p/go.crypto/pbkdf2
How session id should be generated and passed to the user?

If you mean how you can authenticate logged in users, then you can use this package:

    go get github.com/dchest/authcookie
How session information should be saved? (cookie? file? database? memory?)

Up to you, but generally it's better to avoid cookies for storing anything other than IDs. There are a few packages for "sessions" like in PHP, but I don't remember their names.

One more important question to add:

How do I protect against XSRF attacks?

    go get code.google.com/p/xsrftoken
You can read documentation for these packages here: http://go.pkgdoc.org/

As for HTTPS, it's a complicated thing. Pick any good book on it, then apply your knowledge to the standard package crypto/tls (http://golang.org/pkg/crypto/tls/).



Wow, Thank you very much!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: