Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not compliant with RFC4122 spec #34

Open
rogerclermont opened this issue Jul 16, 2018 · 1 comment
Open

Not compliant with RFC4122 spec #34

rogerclermont opened this issue Jul 16, 2018 · 1 comment

Comments

@rogerclermont
Copy link

rogerclermont commented Jul 16, 2018

The generated variant for nu7hatch uuids does not seem to be compliant with the RFC 4122 spec; this results in all nu7hatch uuids failing any RFC4122-based compliance/validation checks.

Quoting the spec (from https://tools.ietf.org/html/rfc4122#section-4.1.1)

4.1.1.  Variant
...

Msb0  Msb1  Msb2  Description
...
    1     0     x    The variant specified in this document.
...

Note though that the variant of nu7hatch uuids has these MSB bits set to 01, rather than 10; example code:

package main

import (
	"fmt"

	"github.com/nu7hatch/gouuid"
)

func main() {

	// create a new v4 uuid
	v4UUID, err := uuid.NewV4()
	if err != nil {
		panic(err.Error())
	}

	// RFC4122 states the variant format should be MSB0==1 and MSB1==0;
	// https://tools.ietf.org/html/rfc4122#section-4.1.1
	fmt.Printf("%08b\n", v4UUID.Variant())

}

Output:
01000000

@cyberkryption
Copy link

cyberkryption commented Feb 9, 2022

Please fix this as it breaks many other projects that rely on govalidator. Also the fact that it is incompatible with main go uuid library is poor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants