Tech News
← Back to articles

Fast cryptographically safe GUID generator for Go

read original related products more articles

guid

Fast cryptographically safe Guid generator for Go. By Stan Drapkin.

Go playground

package main import ( "fmt" "github.com/sdrapkin/guid" ) func main () { for range 4 { fmt . Printf ( "%x

" , guid . New ()) } fmt . Println () for range 4 { g := guid . New () fmt . Println ( & g ) // calls g.String() } }

79c9779af20dcd21fbe60f3b336ed08c da2026d38edca4371a476efd41333d23 88c3033b002b0e73321509ef26de607f a84e961ff7f09f5210ea04585f152e73 WF8MvK5CUOrI-enEuvS0jw AOp8Voi5knpu1mg3RjzmSg gxOQRIVR4B_uGHD6OP76XA Zo_hpnDxkOsAWLk1tIS6DA

Guid is ~10x faster than github.com/google/uuid

guid.New() is 6~10 ns

is 6~10 ns guid.NewString() is 40~60 ns

is 40~60 ns String() on existing guid is ~40 ns

... continue reading