https://github.com/jancajthaml-go/damm
damm check-digit validator and generator
https://github.com/jancajthaml-go/damm
checkdigit checksum damm digit
Last synced: 5 months ago
JSON representation
damm check-digit validator and generator
- Host: GitHub
- URL: https://github.com/jancajthaml-go/damm
- Owner: jancajthaml-go
- License: unlicense
- Created: 2017-08-03T06:53:14.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2021-02-18T07:51:52.000Z (over 5 years ago)
- Last Synced: 2023-09-05T03:12:30.392Z (almost 3 years ago)
- Topics: checkdigit, checksum, damm, digit
- Language: Go
- Homepage:
- Size: 23.4 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## damm checksum algorithm
[](https://goreportcard.com/report/jancajthaml-go/damm)
### Usage ###
```
import "github.com/jancajthaml-go/damm"
ok := damm.Validate("00123014764700968325")
digit, error := damm.Digit("x")
checksum := damm.Generate("1")
```
### Performance ###
```
BenchmarkDammSmall-4 500000000 3.80 ns/op 0 B/op 0 allocs/op
BenchmarkDammLarge-4 50000000 38.5 ns/op 0 B/op 0 allocs/op
BenchmarkDammSmallParallel-4 1000000000 2.09 ns/op 0 B/op 0 allocs/op
BenchmarkDammLargeParallel-4 100000000 15.2 ns/op 0 B/op 0 allocs/op
```
verify your performance by running `make benchmark`
### Resources ###
* [Wikipedia - Damm algorithm](https://en.wikipedia.org/wiki/Damm_algorithm)