I am writing a Go OAuth application in which I am generating a UUID and using it as an accessToken, and returning it to the customer. I don't want to save naked accessToken in DB because it is valid for a long time.. So I am generating a hash using Sha1 and saving it like below
import "github.com/pborman/uuid"
accessToken := uuid.NewRandom()
mac := hmac.New(sha1.New, mysecretkey)
mac.Write([]byte(accessToken)
signed := mac.Sum(nil)
accessTokenDB hex.EncodeToString(signed)
By using uuid as accessToken gives me very low probability of collision. I want to know if accessTokenDB will also give same very low probability of collision or not. I am saving accessTokenDB to a column which has unique index.