Skip to content

Commit e5fa7f5

Browse files
committed
v0.7.0
Ensures that 11-digit CD keys aren't falsely rejected, while preserving strict option if ever needed
1 parent 46b9a69 commit e5fa7f5

File tree

4 files changed

+12
-7
lines changed

4 files changed

+12
-7
lines changed

.vscode/settings.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"makefile.configureOnOpen": false
3+
}

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ module github.com/dgurney/unikey-mod7
22

33
go 1.16
44

5-
require github.com/dgurney/unikey v0.6.0
5+
require github.com/dgurney/unikey v0.7.0
66

77
//replace github.com/dgurney/unikey => ../unikey

go.sum

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
github.com/dgurney/unikey v0.6.0 h1:mS10leryi6EyE7NNRAjKy+MPdv4i/UoHJ9fJeskbD1E=
2-
github.com/dgurney/unikey v0.6.0/go.mod h1:4ImSgAHRaOPeTH03ca4u9SuTuUyHlNzjzs8BPuoraSM=
1+
github.com/dgurney/unikey v0.7.0 h1:SnfRB3wB9zf3Pe08spdXNcKYX0BUExtm5Waa76ijGws=
2+
github.com/dgurney/unikey v0.7.0/go.mod h1:4ImSgAHRaOPeTH03ca4u9SuTuUyHlNzjzs8BPuoraSM=
33
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
44
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
55
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=

main.go

+6-4
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import (
2424
"github.com/dgurney/unikey/validator"
2525
)
2626

27-
const version = "0.6.0"
27+
const version = "0.7.0"
2828

2929
func init() {
3030
rand.Seed(time.Now().UnixNano())
@@ -41,7 +41,8 @@ func main() {
4141
t := flag.Bool("t", false, "Show how long the generation took.")
4242
validate := flag.String("v", "", "Validate a CD or OEM key.")
4343
ver := flag.Bool("ver", false, "Show version information and exit.")
44-
Is95 := flag.Bool("95", false, "Apply Windows 95 rules to OEM/CD key validation.")
44+
Is95 := flag.Bool("95", false, "Apply Windows 95/equivalent old product rules to OEM/CD key validation.")
45+
strict11Digit := flag.Bool("11s", false, "Enforce check digit validation on 11-digit CD keys (should not be needed in regular cases)")
4546
flag.Parse()
4647

4748
if *ver {
@@ -84,8 +85,9 @@ func main() {
8485
switch {
8586
case len(k) == 12 && k[4:5] == "-":
8687
ki = validator.Mod7ElevenCD{
87-
First: k[0:4],
88-
Second: k[5:12],
88+
First: k[0:4],
89+
Second: k[5:12],
90+
EnableCheckDigitRule: *strict11Digit,
8991
}
9092
case len(k) == 11 && k[3:4] == "-":
9193
ki = validator.Mod7CD{

0 commit comments

Comments
 (0)